|
[ANet or other maybe] Auto-remove dead servers from serverlist
#341083
09/10/10 14:00
09/10/10 14:00
|
Joined: May 2009
Posts: 445 Peine, Germany
Razoron
OP
Senior Member
|
OP
Senior Member
Joined: May 2009
Posts: 445
Peine, Germany
|
Hi, the serverlist is stored in a MySQL database on a debian root server. Everyone can host games. But what, when the internet connection of the hosting gamer is interrupted? The server is still in the serverlist, but in reality it doesn't exist anymore. How to remove the "server corpses"?
- Let the server do "cronjobs" every minute to check if he can connect to the server.
But how to do that? I could code a program using winsock, that runs on the server. The problem: How to connect to an ANet game server without calling the EVENT_CONNECT events.
Any suggestions how to do this and cleanup the serverlist?
Last edited by Razoron; 09/10/10 14:01.
|
|
|
Re: [ANet or other maybe] Auto-remove dead servers from serverlist
[Re: Razoron]
#341085
09/10/10 14:20
09/10/10 14:20
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
Expert
|
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
We send updates. If a server on the list isn't updated after waiting for 60 seconds, then that means the server is not running any more.
Then (if I remember correctly) every time someone attempts to download the list of servers, we run a code to check which server entries in the list have not been updated during the past 60 seconds, and those are deleted before returning the server list to the one who requested it.
May not be the best method, but it works great for us.
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
Re: [ANet or other maybe] Auto-remove dead servers from serverlist
[Re: Germanunkol]
#341086
09/10/10 14:26
09/10/10 14:26
|
Joined: May 2009
Posts: 445 Peine, Germany
Razoron
OP
Senior Member
|
OP
Senior Member
Joined: May 2009
Posts: 445
Peine, Germany
|
Yes, thats a solution without an external cleaner program. It is not the fastest, but possible. Thanks . Other suggestions are still welcome.
|
|
|
Re: [ANet or other maybe] Auto-remove dead servers from serverlist
[Re: Razoron]
#341099
09/10/10 18:35
09/10/10 18:35
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
Why not use NAT-PMP and/or UPnP to open the ports? The players want to play the game, not play with their routers. (I know that this is Off-Topic)
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: [ANet or other maybe] Auto-remove dead servers from serverlist
[Re: Razoron]
#341607
09/18/10 16:08
09/18/10 16:08
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
Serious User
|
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
Then (if I remember correctly) every time someone attempts to download the list of servers, we run a code to check which server entries in the list have not been updated during the past 60 seconds, and those are deleted before returning the server list to the one who requested it. The serverlist template of ANet does it exactly this way. This method is great because it can be done in PHP+SQL without a special program or setting on the server. A much cleaner solution would be server-side checking for the "connectablility" of the servers. You could also implement the first methode and let the client (the one who is searching) check if he can connect to the servers in the list. This way you can also get informations about the ping to the server.
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
Re: [ANet or other maybe] Auto-remove dead servers from serverlist
[Re: darkinferno]
#344776
10/20/10 16:36
10/20/10 16:36
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
Serious User
|
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
You could do it with sockets. Every server has an opened udp socket and the client tries to send a packet to them and waits for an acknowledge packet. ANet although only supports one udp socket opened at the same time so this would be slow. But if you access the windows socket functions from Lite-C you could open more sockets at the same time => faster But I never tested this, so it's possible that this idea won't work good/fast enough.
Checking it through a timestamp in the sql db is also no bad methode at all. So the decision is yours if you think it's worth to try the socket based methode. I never did...
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
|