udp - reading partially from sockets -


I have a small test program that sends a lot of udp packets between client-> server-> clients (ping / pong Test). Packets are fixed on each run (the maximum allowable size of the last run eD packet) I am packing the packet with the random data in addition to the beginning of each packet number, so I'm only interested in seeing if I'm on the client All the packets will meet again

I am using sendto () and recvfrom () and I only read sizeof (packet_number) (which is an int in this case). What happens to the rest of the data? Does it end in the fictional country? Or what new packet comes up with this "old" data?

(using linux)

read each UDP socket with D-keys Gets a complete datagram of kernel socket buffer whether your userbuffer buffer size. It is:

  • If your buffer is large, then the next pending figure, you will read your buffer size less.
  • If your buffer is small, then you read your buffer size value and the rest of the data is discarded.
  • You can set the MSG_TRUNC option to flag , so the length of the entire figure, not just the portion read in your UserBuffer buffer.

Hope this will be helpful.


Comments