Client-side NAT keepalive function?

Posted by Linda on Wed 15 Mar 2006 08:48 PM — 7 posts, 27,394 views.

Sweden #0
These days, a lot of people are stuck behind NAT routers with fixed timeouts that are hard or even impossible to change. Some games have implemented commands such as IDLE (penn) and KEEPALIVE (Tiny) that keep the connection alive without actually leading to any player activity (since many games also frown on people using scripts to keep themselves from not running into the game's idle limits). With these commands, the player stays idle but the connection deidles every x minutes to avoid being dropped by the router.

Apparently, this can also be done client-side, and I think this would be an excellent addition, since not all games have implemented this server-side.
Australia Forum Administrator #1
What does the client send? It would have to send something to keep the router happy. Whatever it is, you could send it on a 1-minute timer, or something.
Sweden #2
When you use the idle/keepalive command built into the MUSH, then yes, you use a trigger to send the command at whatever interval you need.The key is that sending this command to the MUSH doesn't produce any activity as far as the MUSH is concerned.

To borrow the description from PennMUSH's helpfiles:

IDLE

This command does nothing. It does not reset a connection's idle time. It is useful for people who are connecting from behind a NAT gateway with a short fixed timeout; if you're in this situation, have your client send the IDLE command every minute or so, and the NAT connection won't time out (but you won't appear, to other players, to be active).

I am not entirely sure how this could be done client-side. :) Someone who is developing a new client for Mac told me she had just implemented a client-side keepalive function, instead of depending on the MUSH to have an idle/keepalive command, since it is not implemented by everyone yet.

USA #3
Seems that all you need to do is receive some input, and throw it away. But that implies that the server is sending you input, which isn't what you want.

Maybe you could send the server a zero byte? It would probably just throw it away in the string parsing, before it does idle checks etc.
Australia Forum Administrator #4
It depends a bit on what the server would accept as "no input" but the router would take as "data".

If the server supports backspacing, maybe sending:

X<backspace>

would work.

In VBscript this would be something like:


Send "X" & chr (8)


If you make a timer and "send to script" that, every minute, it might work. However some servers expect clients to do backspacing. You could try however.

I tried this timer:


<timers>
  <timer enabled="y" 
         minute="1"    
         send_to="12"
>
  <send>
Send "X" &amp; chr (8)</send>
  </timer>
</timers>


However with SMAUG at least, it was not a big success, as I simply saw X followed by a little box on my screen. Evidently it did not handle backspaces.

Also, the "Send" function appends a carriage-return/linefeed so it was the same as sending a newline anyway.

Maybe just sending a blank line every 10 minutes or so would be acceptable to the MUD, and keep the connection alive. The MUD should probably be designed such that someone simply hitting <return> does not clear their AFK flag.
Australia Forum Administrator #5
Quote:

Someone who is developing a new client for Mac told me she had just implemented a client-side keepalive function ...


Maybe ask her how it was done?
Sweden #6
I'll see if I can get an explanation of how she was planning to implement it. :)