|
Page 1 of 1
|
[ 11 posts ] |
|
| Author |
Message |
|
John Pritchett
Site Admin
Joined: Sun Dec 24, 2000 3:00 am Posts: 3151 Location: USA
|
 TW Keepalive
I've been wanting to add some kind of keepalive feature to TW. I notice that when I leave a game sitting, even on my local machine, it often loses its connection without a graceful close on either the client or the server. When this happens, the connection still takes up a node on TWGS, and the TW process remains in memory until the inactivity timeout kicks in on TW and shuts it down. I have found that using a keepalive on TW can keep the connection active (though I've only let it run for about 16 hours so far).
What I'm wondering is what, if anything, I could use as a keepalive packet without effecting any helpers, scripts or other clients. If I could guarantee that every connection was through Telnet, I could use the Telnet command IAC+NOP, and Telnet would strip it out and ignore it, guaranteeing that it wouldn't effect the player. But obviously I can't assume everyone is using Telnet. So the question is, can I use a Telnet command like this with helpers? Do helpers strip out Telnet commands (#255+COMMAND)? The other question I have is, since this sequence is only sent every 60 seconds of inactivity, would it impact helpers or scripts even if it's not stripped? It would never appear as part of a game data stream. It would never interrupt a string that a script is waiting for, for example.
_________________ John Pritchett EIS --- Help fund the TradeWars websites! If you open a hosting account with A2 Hosting, the service EIS uses for all of its sites, EIS will earn credits toward its hosting bill.
|
| Wed May 18, 2011 10:54 pm |
|
 |
|
John Pritchett
Site Admin
Joined: Sun Dec 24, 2000 3:00 am Posts: 3151 Location: USA
|
 Re: TW Keepalive
Ok, so I've gone ahead and activated this feature in the game since I didn't get any feedback against it. We'll see how it works in practice. If anyone has any problems at all with this on the beta, let me know and I'll adjust it or yank it as needed.
_________________ John Pritchett EIS --- Help fund the TradeWars websites! If you open a hosting account with A2 Hosting, the service EIS uses for all of its sites, EIS will earn credits toward its hosting bill.
|
| Sat May 21, 2011 11:07 am |
|
 |
|
Cruncher
Ambassador
Joined: Fri Feb 23, 2001 3:00 am Posts: 4016 Location: USA
|
 Re: TW Keepalive
I'm running the TWX KeepAlive now in HHT 2010. How do I "turn on" the beta keepalive? Or is that just a given in an unlimited time game?
I would prefer this to be a player side turn on/off feature. I wouldn't want the keepalive running in a time limit game, unless I specifically told it to, for say a potty break.
_________________
BOTE 1998 Champs: Team Fament HHT 2015 Champs: Cloud09 Big Game 2016 Champs: Draft team HHT 2018 Champs: Rock Stars Big Game 2019 Champs: Draft Team
Classic Style Games Here: telnet://crunchers-twgs.com:2002 Web page from 1990's: https://web.archive.org/web/20170103155645/http://tradewars.fament.com/Cruncher/tradewar.htm Blog with current server info: http://cruncherstw.blogspot.com Discord: https://discord.gg/4dja5Z8 E-mail: Cruncherstw@gmail.com FaceBook: http://www.facebook.com/CrunchersTW
|
| Sat May 21, 2011 12:18 pm |
|
 |
|
Big D
Veteran Op
Joined: Tue Nov 28, 2006 4:04 pm Posts: 5025
|
 Re: TW Keepalive
Invisible keep alive shouldn't effect any scripts. Mombot has a built in keep alive, so if you use mombot there's no need to run the keep alive script that comes with twx.
|
| Sat May 21, 2011 12:42 pm |
|
 |
|
Kavanagh
Ambassador
Joined: Wed Feb 28, 2001 3:00 am Posts: 1410 Location: Boo! inc. Ireland
|
 Re: TW Keepalive
John Pritchett wrote: I've been wanting to add some kind of keepalive feature to TW. I am puzzled as to the need for this. Used be, we who wrote, had and used them, were sort of cheating, at a time when bandwidth was an issue and sysops naturally made provision. I'm sure that I am missing something.
|
| Sat May 21, 2011 2:20 pm |
|
 |
|
John Pritchett
Site Admin
Joined: Sun Dec 24, 2000 3:00 am Posts: 3151 Location: USA
|
 Re: TW Keepalive
I think there's some misunderstanding about what this is. It's meant to be a network keep-alive, not a TW keep-alive. When a script sends a command every 30 seconds or so, that's making TW think that the player is still active so that the player will never timeout do to inactivity. If TWGS sends a command to the client, it won't effect the inactivity timeout. TWGS could send keepalives while the client is inactive and eventually times out. The point of TWGS sending a keepalive is just to keep the connection active because for some reason connections are going dead on this server (and I assume others as well).
I've been testing long, inactive connections on this server to see if this keepalive shows any improvement. Unfortunately, it doesn't keep the connection from dropping. But, there's a very important thing that it does do. If the connection goes dead, it's an ungraceful close of the socket, and neither the client nor the server gets notification of the drop. This means that TWGS keeps the node active and the game continues to run. The connection won't get cleared until either the client or the server attempts to send data. At that point, whichever attempted to send data discovers that the socket is dead and will close. So if TWGS is sending a keepalive every 60 seconds, then the longest that a dead connection will remain active is 60 seconds. Once TWGS attempts to send this keepalive, it'll detect the dropped connection and close the game and clear the node.
_________________ John Pritchett EIS --- Help fund the TradeWars websites! If you open a hosting account with A2 Hosting, the service EIS uses for all of its sites, EIS will earn credits toward its hosting bill.
|
| Sat May 21, 2011 11:56 pm |
|
 |
|
Cruncher
Ambassador
Joined: Fri Feb 23, 2001 3:00 am Posts: 4016 Location: USA
|
 Re: TW Keepalive
Very nice. So rather than calling this a keepalive, we can call it a clean exit from the game, they drop to the menu but stay connected to the server?
And player timeout disconnects will still work if they aren't running scripts themselves to stay connected - TWX KeepAlive or Mombot.
Am I understanding this correctly?
_________________
BOTE 1998 Champs: Team Fament HHT 2015 Champs: Cloud09 Big Game 2016 Champs: Draft team HHT 2018 Champs: Rock Stars Big Game 2019 Champs: Draft Team
Classic Style Games Here: telnet://crunchers-twgs.com:2002 Web page from 1990's: https://web.archive.org/web/20170103155645/http://tradewars.fament.com/Cruncher/tradewar.htm Blog with current server info: http://cruncherstw.blogspot.com Discord: https://discord.gg/4dja5Z8 E-mail: Cruncherstw@gmail.com FaceBook: http://www.facebook.com/CrunchersTW
|
| Sun May 22, 2011 9:51 am |
|
 |
|
Micro
Ambassador
Joined: Wed Apr 20, 2011 1:19 pm Posts: 2559 Location: Oklahoma City, OK 73170 US
|
 Re: TW Keepalive
It would probably be better to call it an "Are You There". It allows the server to release the resources of a dropped connection without waiting 5 minutes for the session to time out.
Back in the Dial-Up days, it was considered extremely rude for a player to drop carrier like that.
_________________ Regards, Micro Website: http://www.microblaster.net TWGS2.20b/TW3.34: telnet://twgs.microblaster.net:2002
ICQ is Dead Jim! Join us on Discord: https://discord.gg/zvEbArscMN
|
| Sun May 22, 2011 5:35 pm |
|
 |
|
ElderProphet
Commander
Joined: Tue Oct 07, 2003 2:00 am Posts: 1134 Location: Augusta, GA
|
 Re: TW Keepalive
I don't foresee any problem JP, but as MicroBlaster mentioned, the Telnet command Are You There (#255 #246 I believe, or maybe #255 #253 #246) seems like the logical choice for this test. And if memory serves, TWGS already implements this command elsewhere, upon connection I think.
_________________ Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.
|
| Sun May 22, 2011 8:32 pm |
|
 |
|
John Pritchett
Site Admin
Joined: Sun Dec 24, 2000 3:00 am Posts: 3151 Location: USA
|
 Re: TW Keepalive
It was intended to be a keepalive in the same sense as the sockets keepalive:
"An application can request that a TCP/IP provider enable the use of "keep-alive" packets on TCP connections by turning on the SO_KEEPALIVE socket option."
That option didn't show any improvement in keeping connections alive (maybe because it's not a requirement on all sockets implementations). But yeah, since the "keepalive" I added also fails to keep the connection alive, and only serves to trigger an error and graceful close, you're right, it really is more of an "are you there" function at this point.
As far as which commands to send, I think I'll stick with IAC+NOP for now, because that doesn't illicit a response in a telnet client. IAC+YATHERE expects a response which I'd then have to filter out to avoid resetting the TW inactivity timeout.
This has been active on the server for several days now and I haven't had any complaints.
_________________ John Pritchett EIS --- Help fund the TradeWars websites! If you open a hosting account with A2 Hosting, the service EIS uses for all of its sites, EIS will earn credits toward its hosting bill.
|
| Sun May 22, 2011 10:43 pm |
|
 |
|
Trivius
Staff Sergeant
Joined: Wed Jun 01, 2011 9:45 pm Posts: 15 Location: Inculcatus, Votivus
|
 Re: TW Keepalive
For additional consumption would it be practical to instead or in addition send queuing messages such as locally (at the TWGS) by running a listener that resets upon the receipt of new packages and if after exceeding 60-secionds queues a: “Connection idling detected…” and thereafter giving a series of shutting down messages, e.g., “Connection closing in x-minutes due to idling…”; as this would greatly aid scripting, such as when a script stalls out due to whatever reason.
Also what about including an internal process when connections are forced closed locally on the TWGS (or when the TWGS application itself detects a shutdown/critical error) that would sent a dialog to the players warning that the game will be closing in the next 30-seconds or 1-minute (thus giving them a bit of time to find a safer place instead just closing down or having it as an option for the server operator to send out 2/5-minutes warnings), for example?
_________________ "Learn your rules, you’d better learn your rules, if you don’t, you’ll be eaten in your sleep, hhrrch!" ~ Dwight Schrute, The Office (U.S.)
"Democracy is a pathetic belief in the collective wisdom of individual ignorance." ~ H. L. Mencken
|
| Thu Jun 02, 2011 10:36 pm |
|
 |
|
|
Page 1 of 1
|
[ 11 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 16 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|