1998Q4/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD&#45;Dev] Re: Quick socket question -->
<!--X-From-R13: X Q Znjerapr <pynjNhaqre.rate.ftv.pbz> -->
<!--X-Date: Mon, 9 Nov 1998 18:01:34 &#45;0800 -->
<!--X-Message-Id: 199811100156.RAA15293#under,engr.sgi.com -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: E0zcM3X&#45;0002YP&#45;00#mail,kanga.nu -->
<!--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:claw#under,engr.sgi.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="msg00802.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00804.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00793.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00794.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00803">Author</A>
&nbsp;|&nbsp;<A HREF="#00803">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00803">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>: J C Lawrence &lt;<A HREF="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</A>&gt;</LI>
<LI><em>Date</em>: Mon, 09 Nov 1998 17:56:49 -0800</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, 07 Nov 1998 20:02:27 -0800 
J C Lawrence&lt;claw#kanga,nu&gt; wrote:

&gt; On Sat, 7 Nov 1998 15:06:42 -0600 (CST) Cat &lt;cat#bga,com&gt; wrote:

&gt;&gt; Anyway, I got a couple compatibility problems involving select()
&gt;&gt; and accept() worked out, but I've noticed the return of a problem
&gt;&gt; we sometimes had under Linux with the old DragonSpires server,
&gt;&gt; which is the ancestor of the Furcadia server code.  After the
&gt;&gt; game is shut down or the server code crashes, and it tries to
&gt;&gt; restart, it fails to bind the port for the next 15-20 minutes.

&gt; Yes.  This is very very standard and actually even predictable.
&gt; The exact causes (and I think the handling) are well documented in
&gt; Steven's TCP/IP books (which are roughly 50 miles south of me
&gt; right now, at work).  Translation: Its in the book, I don't
&gt; remember the details, I'll look it up on Monday if nobody does it
&gt; before me.

Okay, the relevant passage in Steven's is on pages 242 thru 246 and
concerns the 2MSL Wait State. I'd quote it here except for its
length and my unwillingness to type that much before I leave.  

In summary however (all typoes are mine):

  "The TIME_WAIT state is also called the 2MSL wait sate.  Every
implementation must chose a value for the "maximum segment lifetime"
(MSL).  It is the maximum amount of time any segment can exist in
the network before being discarded.  We know this time limit is
bounded, since TCP segments are transmitted as IP datagrams, and the
IP datagram has the TTL field that limits its lifetime.

...

  "Given the MSL value for an implementation, the rule is: when TCP
performs an active close, and sends the final ACK, that connection
must stay in TIME_WAIT state for twice the MSL.  This lets TCP
resend the final ACK in case this ACK is lost (in which case the
other end will time out and retransmit its final FIN).

  "Another effect of this 2MSL wait is that while the TCP connection
is in the 2MSL wait, the socket pair defining the connection (client
IP address, client port number, server IP address, server port
number) cannot be reused.  That connection can only be reused when
the 2MSl wait is over."

  "Unfortunately most implementations (ie the Berkeley derived ones) 
impose a more stringent constraitn.  By default a local port number
cannot be reused while that port number is the local port number of
a socket pair that is in the 2MSL wait. ...

  "(side note) Some implementations and API's provide a way to
bypass this restriction.  With the sockets API, the SO_REUSEADDR
socket option can be specified.  It lets the caller assign itself a
local port number that's in the 2MSL wait, but we'll see that the
rules of TCP still prevent this number from being part of a
connection that is in the 2MSl wait."

Ultimate translation: Run, do not walk, and go buy a copy of the
Steven's TCP/IP books.  Read them.  Study them.  Sleep with them.
Treasure them.  You will not regret it and you code will appreciate
it.  If you want to save $$$, see:

 <A  HREF="http://www.bookpool.com/.x/nt34rcdnv8/ss/1?qs=TCP%2FIP+Illustrated">http://www.bookpool.com/.x/nt34rcdnv8/ss/1?qs=TCP%2FIP+Illustrated</A>

-- 
J C Lawrence                               Internet: claw#kanga,nu
(Contractor)                              Internet: coder#kanga,nu
---------(*)                     Internet: claw#under,engr.sgi.com
...Honourary Member of Clan McFud -- Teamer's Avenging Monolith...


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00793" HREF="msg00793.html">[MUD-Dev] Re: Quick socket question</A></STRONG>
<UL><LI><EM>From:</EM> J C Lawrence &lt;claw#kanga,nu&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00802.html">[MUD-Dev] Re: A Small Conceptual Object System For MUDs</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00804.html">[MUD-Dev] Spell components, chemistry, and the like...</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00793.html">[MUD-Dev] Re: Quick socket question</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00794.html">[MUD-Dev] Re: Quick socket question</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00803"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00803"><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>[MUD-Dev] Re: Quick socket question</STRONG>, <EM>(continued)</EM>
<ul compact>
<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>
<LI><strong><A NAME="00786" HREF="msg00786.html">[MUD-Dev] Re: Random Quest Generation</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Fri 06 Nov 1998, 21:05 GMT
<UL>
<li>&lt;Possible follow-up(s)&gt;<br>
<LI><strong><A NAME="00787" HREF="msg00787.html">[MUD-Dev] Re: Random Quest Generation</A></strong>, 
Michael.Willey <a href="mailto:Michael.Willey#abnamro,com">Michael.Willey#abnamro,com</a>, Fri 06 Nov 1998, 22:16 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00785" HREF="msg00785.html">[MUD-Dev] Random Quest Generation</A></strong>, 
chris <a href="mailto:chris#realm,zfn.uni-bremen.de">chris#realm,zfn.uni-bremen.de</a>, Fri 06 Nov 1998, 17:37 GMT
</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>