[MUD-Dev] Re: Quick socket question

Ben Greear greear at cyberhighway.net
Sat Nov 7 15:36:57 New Zealand Daylight Time 1998


I run on Slackware, 3.3 right now, which is older than redhat 5.0.

If I do a proper shutdown (with the close(socket_descriptor) call),
then I can re-bind to it in a matter of seconds.

Make sure you are checking the return values for all such system
calls.

Also, I log-out every connected descriptor before I try to close
the main listening socket.  That might have something to do with
it.

Ben

On Sat, 7 Nov 1998, Dr. Cat wrote:

> Well, we were going to install Solaris 86 on the Furcadia server machine 
> to replace the buggy older version of BSDI it had on it.  But the 
> sysadmin out there suggested going to Red Hat Linux instead, because it's 
> a BDS family rather than a SYSV family, and there might be fewer 
> problems.  I agreed.  I don't know how hard getting it going on SYSV 
> would have been, but I know my O'Reilly "Using C on the Unix system" is 
> so old that it says Berkeley Unixes have sockets and SYSV don't!  Surely 
> SYSV has to have sockets now, what with this "internet" thing having 
> gotten so popular since this book was written - don't they?
> 
> Anyway, I got a couple compatibility problems involving select() and 
> accept() worked out, but I've noticed the return of a problem we 
> sometimes had under Linux with the old DragonSpires server, which is the 
> ancestor of the Furcadia server code.  After the game is shut down or the 
> server code crashes, and it tries to restart, it fails to bind the port 
> for the next 15-20 minutes.  This is an improvement over the Linux of 4 
> years ago, which apparently didn't have a timeout for this case and would 
> leave the game unaccessible for hours, days, or potentially forever until 
> I could successfully beg the uncooperative sysadmin of that system for a 
> reboot!  Still, I'd like to fix this problem if I can.
> 
> I thought at first it was because I wasn't closing the socket when the 
> accept() problem I was having crashed it.  But I did a proper operator 
> shutdown, which takes the bound socket and does shutdown(mastsock, 2)
> and close(mastsock) before existing.  Do I need to do anything more on 
> closing to make sure the port is freed up, even if there's some 
> recalcitrant user's machine out there still desperately trying to talk to 
> it?  Or is there a setsockopt option I need to set differently?  Or is 
> there a sysadmin tweak to change that timeout value?  If anyone's dealt 
> with this issue under Linux before (or any other Unix that has the same 
> issue) I'd appreciate a pointer.  :X)
> 
> *-------------------------------------------**-----------------------------* 
>    Dr. Cat / Dragon's Eye Productions       ||       Free alpha test:
> *-------------------------------------------**  http://www.bga.com/furcadia
>   Furcadia - a new graphic mud for PCs!     ||  Let your imagination soar!
> *-------------------------------------------**-----------------------------*
> 
> P.S. I've been to busy to reply to anything on the list, but Raph, I 
> really liked the Laws page you set up, and I sent the URL to all of our 
> volunteer staff and to some friends to browse through.  Though I would 
> have worded that stamp collector thing a lot differently.  I'm still 
> waiting for that lunch if you want to talk about how to revise that or 
> anything.  :X)
> 
> -- 
> MUD-Dev: Advancing an unrealised future.
> 

Ben Greear (greear at cyberhighway.net)  http://www.primenet.com/~greear 
Author of ScryMUD:  mud.primenet.com 4444
http://www.primenet.com/~greear/ScryMUD/scry.html






More information about the MUD-Dev mailing list