Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Bing, Yandex

Members: 0
Guests: 3
Stats
Files
Topics
Posts
Members
Newest Member
481
3,734
19,366
618
Micheal64X
Today's Birthdays
Vintar (28)
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 >>