Interactive 'Keep-Alive'

Posted by Drraagh on Thu 09 Nov 2006 05:11 AM — 3 posts, 17,278 views.

#0
There's one thing I've noticed with my connection to certain MU*s, no matter what client I use, and no matter how I toy with the settings of my connection. That is that I get a connection that freezes unless there is data regularlly sent on the line. ON one, I did a series of Semaphores on my character which still allows me to idle out if I go AFK or whatever, but on others I can't get that set up due to whatever restrictions they have.

My workaround for that is for me to send a trigger message to the server every five minutes. Not the prettiest, but something that works. The problem is, that I go AFK and my connection could still go for hours. I haven't looked at scripting yet as the idea just hit me, but I am just wondering if the idea is possible given the system in place before I go looking.

What I want to have is a script that times when I log on, runs some sort of idle keep-alive, but every hour or so (the usual idle-out time for MUs), my client prompts me for some interaction before cutting the connection. My Dial up connection back so long ago used to do that with a popup I had to click OK to or it would disconnect.

I'm going to start researching scripting for other ideas I had, but for this one, I am mainly concerned if it's possible before I start spending time working on it for nothing.
Australia Forum Administrator #1
Yes, that is pretty easy to do.

You could make a plugin, and in it put a handler for OnPluginCommandEntered. In that you could remember the time of the last command actually typed (for going AFK).

Then you could make a timer that checks the time now, compared to the time of the last command. That timer could fire every minute. Of course, the same timer can send something to keep the connection alive as well.

In fact, you can use OnPluginSent to find the last time something was sent to the MUD, and thus not send your "keep alive" if something else was sent recently.

I don't know about the dialog box, because it would sit there waiting for you to press OK, and thus not drop the connection. But, you could play a sound, display a message in red, and if you don't type anything in the next minute, drop the connection. Of course, typing anything should cancel the timeout anyway. Thus all you really need to do is something like, at > 60 minutes but < 61 minutes, display the message, and > 61 minutes, drop the connection.
Australia Forum Administrator #2
See this post:

http://www.gammon.com.au/forum/?id=7488

This does a similar thing, and if you altered it slightly to make the timer function actually send something to keep it connected, then it does exactly what you want.

Or, add another timer that sends some sort of "keep alive" command which fires every couple of minutes.