Jump to content
  • Advertisement
Sign in to follow this  
md_lasalle

Outgoing connection problem

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

Hi all! I'm having troubles with my game server, well, not all of them are having the problem so that's why i post here so i can maybe get a light on this Every 20 seconds, the game server tries to establish a TCP connection with the master server to send its latest game infos. For some strange reasons, after some time, the call to connect() just fails after my predetermined timeout (10 seconds) why would connect() fail after sometime ? thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
What language / OS? What does errno or WSAGetLastError (Or whatever the error reporting function for the platform you're using is) return?

Share this post


Link to post
Share on other sites
If you want to send data every 20 seconds, why not just keep the connection open?

It may be that you're running out of some resource, such as available file descriptors, or have too many sockets waiting in TIME_WAIT, or something like that.

Share this post


Link to post
Share on other sites
Quote:
Original post by hplus0603
or have too many sockets waiting in TIME_WAIT, or something like that.


can you explain this a little more ?

Share this post


Link to post
Share on other sites
When you close a default TCP socket it will wait for any errant data to be recved from the other end of the connection. This effectively leaves the socket open until the TIME_WAIT expires. You cannot open up and infinite number of sockets. 2^16 is the theortical limit.

I strongly recommend you leave the socket open until you are completely finished sending data for the sessions. The connection setup cost is sigificant when using TCP.

Share this post


Link to post
Share on other sites
Quote:
Original post by md_lasalle
TIME_WAIT is defined to what and is there a way to set it up ?
TIME_WAIT is a TCP/IP state, like listening. You can alwayse use setsockopt() with SO_REUSEADDR to avoid the TIME_WAIT phase, but you should check if you really need to first.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!