tags:

views:

242

answers:

3

I'm running a game website where users connect using an Adobe Flash client to a C server running on a Fedora Linux box.

Often users complain about disconnects. Usually they're "Connection reset by peer"-disconnects.

Is there any way to make the connection more stable or does it all depend on the route from the user host to my server?

One thing I tried is to make it more stable by sending PING in clear text every other minute to avoid timeout problems.

Anyone got more ideas?

A: 

where are you running the server?
at home? at work? at a hosting facility?
this will make a very big difference.

Can you design your app to connect to two sockets on the server and then load balance or make it active/passive (or active/active)?

KevinDTimm
We're using co-location at a hosting facility. We got four servers, one is used for the "game rooms". Each user has its own socket. There can be approx 2000 people on-line in an evening (200 max on each server).
Henrik
I was thinking if there's any configuration settings in Linux/setsockopt's et c which I could try to change.
Henrik
No settings that I have used, sockets are typically very robust. Disconnects are unusual in enclosed environments but can happen in 'the real world'. You may have to redesign to use UDP (connectionless) and then create your own protocol on top (alluded to above by the two sockets/load balance/active-active/etc.)
KevinDTimm
A: 

You can use SO_KEEPALIVE TCP socket option.

Adil
+1  A: 

You are not exhausting the number of socket/memory use/cpu that the server process is given on the server, are you?

Do check with ulimit.

Also, if possible try to trace the error message in the source code (when a RST packet is sent--), i.e. when a send() or accept() returns an error value. In such cases print a debug message into the logs; if you really fancy debugging it do a simulation of the server:

  • run it into debug mode on a separate machine (possibly a clone of the server)
  • simulate thousands of connection (or find a network harnessing program)
  • backtrace the call and/or sniff the connection
lorenzog
Also, have you checked (`netstat`) that you're properly releasing the connections when clients quit?
bstpierre