Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!, Sogou

Members: 0
Guests: 10
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » General Discussions » Sockets going into coma
Forum Rules | Mark all | Recent Posts

Sockets going into coma
< Newer Topic :: Older Topic > A good way to stay alive.

Pages:<< prev 1 next >>
Post is unread #1 Jun 24, 2006, 8:08 pm
Go to the top of the page
Go to the bottom of the page

mordecai

GroupMembers
Posts99
JoinedNov 17, 2005

I had been grueling over this for quite some time now, and finally came upon a solution. Basically if you're connecting for a long time with no input receiving, sometimes the sockets will go into a coma (i.e., they won't send data when it should be sent until a lot piles up for a while, and sometimes they won't even wake up). I'm not sure under what networking conditions this occurs, but it happens to me every time nothing happens for 20min (when I'm afk with no one connected or doing anything).

Basically the solution is to slap our little socket every 2 minutes so he doesn't fall asleep. The telnet NOP command is so ever useful for this (NOP=no operation, as in do nothing), so I just send that happy little critter. I'm not actually sure in 2 minutes is the best amount of time, and I also didn't want to add another timer, so this just checks if YOU haven't done anything for 2min - not if no data was sent.

Find:
            write_to_descriptor( d, "Idle timeout... disconnecting.\r\n", 0 );
            d->outtop = 0;
            close_socket( d, TRUE );
            continue;
         }
         else
         {


Add this after:
         	if(d->idle%360==359) { //wake up call every 2 min
         		char buf[3] = { IAC, NOP, '\0' };
         		write_to_descriptor( d, buf, 0 );
         	}


Find:
#define  TELOPT_ECHO        '\x01'

Add this after:
#define  NOP                '\xF1'
       
Pages:<< prev 1 next >>