If you send data over a network and it is broken into packets, is there a set size for each packet? Does it depend on the type of network being sent across?
You can use System.Net.Sockets namespace (TcpListener and TcpClient) for example.
However, you cannot enforce the packet size if you want a large packet because the lower TCP layers will break it into smaller pieces (fragmentation) in order to be transmitted accros the network (further fragmentation of the already fragmented packets can occur if they need to cross the network borders and the MTU of the other network is smaller then the MTU of your network.
And usually you cannot control the packet's size ...
MTU = Maximum Transfer Unit (which can differ from a subnetwork to another) and its maximum size is (64KBytes - <size of the TCP/IP pachet header>).
If you're depending on a fixed message size, you will need to transmit the size of the message as the first thing sent. The recipient would then be able to know how many bytes to expect to receive. In any case, the recipient needs to be able to combine multiple packets in order to re-form the original data.
Chip H.
____________________________________________________________________ If you want to get the best response to a question, please read FAQ222-2244 first
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.