udp recving

Started by
2 comments, last by logout 20 years, 6 months ago
When i call sendto() and recvfrom() ( ecp. the last one ) Are it sure that all the data got sendt/recvived ? Or do i have to do the same as i have to do with TCP ?
Advertisement
quote:Original post by logout
Are it sure that all the data got sendt/recvived ?

yes.

quote:
Or do i have to do the same as i have to do with TCP ?

no.

Creation is an act of sheer will
Usually you will receive your entire packet. You can receive an error, EMSGSIZE (WSAEMSGSIZE), when calling recvfrom(). This indicates that the datagram was too big to fit in your supplied buffer. Depending upon your OS, you will either receive a partial packet up to your buffer size or no packet at all.
quote:Are it sure that all the data got sendt/recvived ?

IF you receive a packet, you are guaranteed that you got the whole thing (or EMSGSIZE as stated - which is typically caused by a programmer error, so it''s not really a protocol issue). Key word here is IF.

quote:
Or do i have to do the same as i have to do with TCP ?

Only if you are fragmenting large messages on your own (not uncommon, and quite necessary if you are coding a reliable protocol on top of UDP). Then on the recvfrom you would basically want to reassemble the fragments as they arrive.

This topic is closed to new replies.

Advertisement