• Advertisement

Archived

This topic is now archived and is closed to further replies.

udp recving

This topic is 5297 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 ?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement