1998Q4/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD&#45;Dev] Re: Quick socket question -->
<!--X-From-R13: Xba Zrbaneq <wyrbaneqNqvipbz.fyvzl.pbz> -->
<!--X-Date: Sat, 7 Nov 1998 14:48:23 &#45;0800 -->
<!--X-Message-Id: 19981107144155.B16799#divcom,slimy.com -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 199811072106.PAA12088#zoom,bga.com -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, [MUD-Dev] Re: Quick socket question</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:jleonard#divcom,slimy.com">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00789.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00791.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00789.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00791.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00790">Author</A>
&nbsp;|&nbsp;<A HREF="#00790">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00790">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>[MUD-Dev] Re: Quick socket question</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Subject</em>: [MUD-Dev] Re: Quick socket question</LI>
<LI><em>From</em>: Jon Leonard &lt;<A HREF="mailto:jleonard#divcom,slimy.com">jleonard#divcom,slimy.com</A>&gt;</LI>
<LI><em>Date</em>: Sat, 7 Nov 1998 14:41:55 -0800</LI>
<LI><em>Cc</em>: Jon Leonard &lt;<A HREF="mailto:jleonard#divcom,slimy.com">jleonard#divcom,slimy.com</A>&gt;</LI>
<LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
On Sat, Nov 07, 1998 at 03:06:42PM -0600, Dr. Cat wrote:

[socket reuse problems]

&gt; I don't know how hard getting it going on SYSV 
&gt; would have been, but I know my O'Reilly "Using C on the Unix system" is 
&gt; so old that it says Berkeley Unixes have sockets and SYSV don't!  Surely 
&gt; SYSV has to have sockets now, what with this "internet" thing having 
&gt; gotten so popular since this book was written - don't they?

SYSV got sockets as a standard feature in SYSVR4.  You need to link with
some extra libraries, which should be listed in the man pages.
It's -lsocket -lnsl or something like that.

&gt; Anyway, I got a couple compatibility problems involving select() and 
&gt; accept() worked out, but I've noticed the return of a problem we 
&gt; sometimes had under Linux with the old DragonSpires server, which is the 
&gt; ancestor of the Furcadia server code.  After the game is shut down or the 
&gt; server code crashes, and it tries to restart, it fails to bind the port 
&gt; for the next 15-20 minutes.  This is an improvement over the Linux of 4 
&gt; years ago, which apparently didn't have a timeout for this case and would 
&gt; leave the game unaccessible for hours, days, or potentially forever until 
&gt; I could successfully beg the uncooperative sysadmin of that system for a 
&gt; reboot!  Still, I'd like to fix this problem if I can.

I've seen the problem, but my current code doesn't exhibit it.  I've
been able to successfully restart the DevMUD server in 2 or 3 seconds,
and on my old server I've actually started up a new MUD on the same
socket that the old one still had players connected to.

That is, the following sequence is possible:

Open socket
Players connect to socket
Server shuts down main socket, but doesn't kick players off
New server opens main socket with same port number
Players connect to socket, and get the new server

After that different players are connected to two different muds,
both nominally using the same port.

&gt; I thought at first it was because I wasn't closing the socket when the 
&gt; accept() problem I was having crashed it.  But I did a proper operator 
&gt; shutdown, which takes the bound socket and does shutdown(mastsock, 2)
&gt; and close(mastsock) before existing.  Do I need to do anything more on 
&gt; closing to make sure the port is freed up, even if there's some 
&gt; recalcitrant user's machine out there still desperately trying to talk to 
&gt; it?  Or is there a setsockopt option I need to set differently?  Or is 
&gt; there a sysadmin tweak to change that timeout value?  If anyone's dealt 
&gt; with this issue under Linux before (or any other Unix that has the same 
&gt; issue) I'd appreciate a pointer.  :X)

I think that it's one of the miscellanious socket options, maybe SO_LINGER?
Since I'm not seeing it anymore, it isn't bothering me.

You're welcome to look at my code either:

(DevMUD prototype)
<A  HREF="http://frost.slimy.com/devmud/prototypes/proto_1/modules/socket/">http://frost.slimy.com/devmud/prototypes/proto_1/modules/socket/</A>

(Better documented code)
<A  HREF="http://slimy.com/~jleonard/src/ipc.html">http://slimy.com/~jleonard/src/ipc.html</A>

The differences between your code and what I did might be enlightening.

Both sets of source code are in the public domain.

Jon Leonard


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="00791" HREF="msg00791.html">[MUD-Dev] Re: Quick socket question</A></strong>
<ul compact><li><em>From:</em> Petri Virkkula &lt;pvirkkul#iki,fi&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00788" HREF="msg00788.html">[MUD-Dev] Quick socket question</A></STRONG>
<UL><LI><EM>From:</EM> "Dr. Cat" &lt;cat#bga,com&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00789.html">[MUD-Dev] Re: Quick socket question</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00791.html">[MUD-Dev] Re: Quick socket question</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00789.html">[MUD-Dev] Re: Quick socket question</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00791.html">[MUD-Dev] Re: Quick socket question</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00790"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00790"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><strong><A NAME="00795" HREF="msg00795.html">[MUD-Dev] ScryMUD [CUSTOM] Released under GNU General Public License</A></strong>, 
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Sun 08 Nov 1998, 05:55 GMT
<LI><strong><A NAME="00792" HREF="msg00792.html">[MUD-Dev] Re: Quick socket question</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Sun 08 Nov 1998, 02:52 GMT
<LI><strong><A NAME="00788" HREF="msg00788.html">[MUD-Dev] Quick socket question</A></strong>, 
Dr. Cat <a href="mailto:cat#bga,com">cat#bga,com</a>, Sat 07 Nov 1998, 21:27 GMT
<UL>
<LI><strong><A NAME="00789" HREF="msg00789.html">[MUD-Dev] Re: Quick socket question</A></strong>, 
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Sat 07 Nov 1998, 22:45 GMT
</LI>
<LI><strong><A NAME="00790" HREF="msg00790.html">[MUD-Dev] Re: Quick socket question</A></strong>, 
Jon Leonard <a href="mailto:jleonard#divcom,slimy.com">jleonard#divcom,slimy.com</a>, Sat 07 Nov 1998, 22:48 GMT
<UL>
<LI><strong><A NAME="00791" HREF="msg00791.html">[MUD-Dev] Re: Quick socket question</A></strong>, 
Petri Virkkula <a href="mailto:pvirkkul#iki,fi">pvirkkul#iki,fi</a>, Sat 07 Nov 1998, 23:24 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00793" HREF="msg00793.html">[MUD-Dev] Re: Quick socket question</A></strong>, 
J C Lawrence <a href="mailto:claw#kanga,nu">claw#kanga,nu</a>, Sun 08 Nov 1998, 04:02 GMT
<UL>
<LI><strong><A NAME="00803" HREF="msg00803.html">[MUD-Dev] Re: Quick socket question</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Tue 10 Nov 1998, 02:01 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00794" HREF="msg00794.html">[MUD-Dev] Re: Quick socket question</A></strong>, 
Adam Wiggins <a href="mailto:adam#angel,com">adam#angel,com</a>, Sun 08 Nov 1998, 04:40 GMT
</LI>
</UL>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>