Reading bytes from a socket

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Diego F.

    #1

    Reading bytes from a socket

    Hello. I have a problem while reading bytes from a socket.

    According to my test, it seems that the buffer maximum size is 8192 bytes.
    Then, I use a byte array with that size to read from the buffer. If the send
    data size is 8192 or less, it works ok.

    But, if I send more that 8192, let's say 10000 bytes, the first time I read
    from the buffer I get 8192, and the second, instead of 1808 bytes, it reads
    8192 again!!!

    Isn't the buffer emptied after the reading?

    --

    Regards,

    Diego F.



  • =?Utf-8?B?aXdkdTE1?=

    #2
    RE: Reading bytes from a socket

    try adding

    Array.Clear(buf fer, 0, buffer.length)

    at the end of your receive method. this way the buffer will be cleared of
    all information and you wont have any remains from the previous read....see
    if that helps
    --
    -iwdu15

    Comment

    Working...