Socket not getting Clear. RRS feed

  • Question

  • I am using .NET 2.0

    Consider the following

    Data on Socket :: "This is the test to check the socket is not getting cleared."

    If the buffer size that i am using to read from the socket is 40 byte.

    It would read something like this :

    1st Read  :: "This is the test to check the socket is "

    2nd Read :: "not getting cleared.   eck the socket"


    Can someone let me know why this is happening.



    Monday, September 11, 2006 4:58 PM


  • Because you are not looking at the number of bytes actually read

    You supplied a buffer with offset f and count n then you received r bytes
    so you should only look at the r bytes not n bytes

    Monday, September 11, 2006 6:08 PM