Jump to content
  • Advertisement

Archived

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

Galileo430

Setting Timeout In a Socket

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

I am trying to figure out how to set a timeout with a socket. For all you who know sockets you know how bad the mircosoft help files are. I don''t know if I even need a "timeout"!? Basicly what I am trying to do is,
  
//Here is some fake code

sendto(masterserver);
recvfrom(masterserver); //Wait 4 seconds before giving up on the responce

sendto(masterserver); // Send agian and so on..

  

Share this post


Link to post
Share on other sites
Advertisement
Hi Galileo430,
I assume your trying to build reliability into UDP, is this correct?

If so, your going to have to get a little bit more technical in your design to accomplish this.

Try doing a search for reliable UDP or something like that. If all else fails I can send you an outline that I h ave put together, I''m using this to write an article covering this topic.

Game On,


Dave "Dak Lozar" Loeser

Share this post


Link to post
Share on other sites
I''m using a simple Windows timer. If the timer event occurs - I send a simple packet to test if the connection still exists. The socket should produce an error if the connection doesn''t exist no more.

Can I send a 0 size packet, to test for an existing connection?

Share this post


Link to post
Share on other sites
With UDP you can send 0-sized packets. TCP will "optimize" them away...

cu,
Prefect

---
Sanity is the trademark of a weak mind.

Share this post


Link to post
Share on other sites

  • 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!