Socket Win shrinking causing socket reset. Buffer filling somewhere? RRS feed

  • Question

  • So I had a "bug" where the host would keep dropping my streamsocket "randomly".  I put up a wire shark and the packet Window starts at: 8192 and then progressively just shrinks and shrinks and shrinks based on the length of the packets it receives.  Eventually the window is near 0 and the host kills the socket connection since I refuse to receive any more data and therefore can't ACK any further packets. 

    My assumption is that there is a buffer somewhere that I need to periodically purge on my socket.  I have no interest in the data being received.  I'm just want to push data through my socket.   Is there a flag I can put on my streamsocket to discard the data as it's received?  Or do I need to run a timer in the background to read and purge the streamsocket inputstream? 
    Tuesday, March 10, 2015 10:40 PM


  • using (DataReader reader = new DataReader(socket.InputStream))
         reader.InputStreamOptions = InputStreamOptions.Partial;
         await reader.LoadAsync(1448);
         while (reader.UnconsumedBufferLength > 0)
             Byte[] message = new Byte[reader.UnconsumedBufferLength];
             await reader.LoadAsync(1448);
    This will work with Bytes. You would want to use reader.ReadString() etc in place of ReadBytes depending on your datastream.   Also the LoadAsync(####) should be the maximum packet size you want to receive. 
    Tuesday, March 24, 2015 6:17 PM

All replies