How Streams are received
- From: "Daniel" <DanielV@xxxxxxxxxxxxxxxx>
- Date: Fri, 21 Jul 2006 18:43:05 +0100
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.
.
- Follow-Ups:
- Re: How Streams are received
- From: Arkady Frenkel
- Re: How Streams are received
- From: David Lowther
- Re: How Streams are received
- From: Alexander Nickolov
- Re: How Streams are received
- Prev by Date: Re: Fundamentals question, is this how it works?
- Next by Date: Re: Fundamentals question, is this how it works?
- Previous by thread: Re: domain sid
- Next by thread: Re: How Streams are received
- Index(es):
Relevant Pages
|