writing buffers to NetworkStream from TCPClient

  • Thread starter Thread starter Rob Tillie
  • Start date Start date
R

Rob Tillie

Does one have to adhere to the usual boundaries from the underlying
protocols? What happens when you write a byte[] which is for example 50 kb
to the stream?

Greetz,
-- Rob.
 
Rob Tillie said:
Does one have to adhere to the usual boundaries from the underlying
protocols? What happens when you write a byte[] which is for example 50 kb
to the stream?

That should be fine - each layer will take care of its own difficulties
(splitting it into packets etc) in order to provide the appearance of a
smooth stream.
 
Kewl !!!
But what happens if I use a raw TCP socket? Then I should take care of the
splitting?
I looked at the MSDN docs, but couldn't find any documentation about this.

Greetz,
-- Rob.

Jon said:
Rob Tillie said:
Does one have to adhere to the usual boundaries from the underlying
protocols? What happens when you write a byte[] which is for example
50 kb to the stream?

That should be fine - each layer will take care of its own
difficulties (splitting it into packets etc) in order to provide the
appearance of a smooth stream.
 
Rob Tillie said:
Kewl !!!
But what happens if I use a raw TCP socket? Then I should take care of the
splitting?
I looked at the MSDN docs, but couldn't find any documentation about
this.

Remember, TCP is over IP. So the IP layer should take care of
creating legit IP packets while the TCP layer adds the proper
signaling. So what Jon said applies to sockets just as well as to
streams. There's no way for you to really know how/where to split the
data (without becoming an expert in TCP/IP, ethernet, ATM, DSL, etc.).
Just throw your bytes at the socket and they'll go. That's the beauty
of layers in a protocol.

mike
 
Back
Top