Re: How Streams are received



Definitely wrong. The amounts of data you are sending at one end
have no relevance whatsoever on the amounts of data that you
receive in your recv calls on the other end of a TCP stream. You
can and often will receive chunks that split your packets and also
chunks that contain pieces from two of your packets.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

"Daniel" <DanielV@xxxxxxxxxxxxxxxx> wrote in message
news:OE0Sg0OrGHA.4236@xxxxxxxxxxxxxxxxxxxxxxx
Sorry to labour this point but i have been unable to find anything on the
net or in my books to make this clear to me.

So can someone give me a yes or no on this. I have an asynchronous socket
client/server setup and a receive buffer of 1024. All my data sent has the
size pre-pended to the first 4 bytes.

If i send 1513 bytes to the client is this what happens:

- Client receives 1024 bytes (full buffer)
- Client reads first 4 bytes and gets the length
- client then reads the rest of the buffer into a memorystream and rbuilds
the data client side

- Client gets another recieve for 535 bytes, the remainder of the data.
- Client checks if it is still waiting for more data (due to the data size
expected) and if it is dont calculate data size as this is all data coming
through
- Client reads these 535 bytes and completes the memory stream. Data
transfer complete.


Is that how i will receive everytime regardless of how quickly data is
sent? So if i send 1513 bytes then immediately after send 500 bytes does
it do the same as above for the 1513 finishing on a receive of 535, then
doa new receive for 500 for the next data coming in, the 500 byte send?

If so i presume it is impossible to have surplus data or redundant data in
the buffer? As you will either be filling it or only receiving thw amount
of bytes left? Is that understanding correct.

I hope someone can set me straight at long last on this trivial point.



.



Relevant Pages

  • Re: How Streams are received
    ... Be aware that system buffer for winsock is 16K so if you'll send big chunks ... into 2 and include additional time due to Nagle algorithm waiting for ACK ... If i send 1513 bytes to the client is this what happens: ... Client reads these 535 bytes and completes the memory stream. ...
    (microsoft.public.win32.programmer.networks)
  • Re: How Streams are received
    ... client/server setup and a receive buffer of 1024. ... If i send 1513 bytes to the client is this what happens: ... Client reads these 535 bytes and completes the memory stream. ...
    (microsoft.public.win32.programmer.networks)
  • Re: How Streams are received
    ... and include additional time due to Nagle algorithm waiting for ACK from ... client/server setup and a receive buffer of 1024. ... If i send 1513 bytes to the client is this what happens: ... Client reads these 535 bytes and completes the memory stream. ...
    (microsoft.public.win32.programmer.networks)
  • How Streams are received
    ... net or in my books to make this clear to me. ... client/server setup and a receive buffer of 1024. ... If i send 1513 bytes to the client is this what happens: ... Client reads these 535 bytes and completes the memory stream. ...
    (microsoft.public.win32.programmer.networks)
  • Group on results of calculated value
    ... Create a second summing query with the projectID and sum ... and sum on amount to Client Total. ... >My recordsource returns currency amounts per client per ...
    (microsoft.public.access.reports)

Loading