Jump to content
  • Advertisement
Sign in to follow this  
jmakitalo

Udp Communication With Sdl_Net

This topic is 2808 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

This might not be directly related to SDL_net, but here it is:

When I'm receiving a packet via UDP, can I assume that when SDLNet_UDP_Recv detects
a packet coming, the whole packet that was sent will be obtained with a single call to this function?

Say that I call SDLNet_UDP_Recv to obtain a packet p. The data that was sent
was N bytes in length. Is it guaranteed that p->len==N holds? Or can it be that p->len<N and I need to call
SDLNet_UDP_Recv until I have read N bytes? If this is true, how to identify the fragments of
the sent packet?

Share this post


Link to post
Share on other sites
Advertisement

When I'm receiving a packet via UDP, can I assume that when SDLNet_UDP_Recv detects
a packet coming, the whole packet that was sent will be obtained with a single call to this function?


In general, yes, UDP delivers an entire packet. If the buffer you pass in to the recv call is not big enough, the overflow is lost.
I'm assuming that SDL preserves this semantic, but if you want to know for sure, check the source code!

Share this post


Link to post
Share on other sites

In general, yes, UDP delivers an entire packet. If the buffer you pass in to the recv call is not big enough, the overflow is lost.
I'm assuming that SDL preserves this semantic, but if you want to know for sure, check the source code!


Thanks. That is good to know.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!