home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.protocols.tcp-ip
- Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!emory!swrinde!zaphod.mps.ohio-state.edu!malgudi.oar.net!news.ans.net!newsgate.watson.ibm.com!yktnews!admin!data!hofer
- From: hofer@rchland.vnet.ibm.com (Kent Hofer)
- Subject: Re: Proper Method of Closing IP Sockets
- Sender: news@rchland.ibm.com
- Message-ID: <1992Nov11.192003.28737@rchland.ibm.com>
- Date: Wed, 11 Nov 1992 19:20:03 GMT
- Disclaimer: This posting represents the poster's views, not necessarily those of IBM
- References: <1992Nov7.034406.19500@blaze.cs.jhu.edu>
- Nntp-Posting-Host: data.rchland.ibm.com
- Organization: IBM Rochester
- Lines: 16
-
- In article <1992Nov7.034406.19500@blaze.cs.jhu.edu>, eifrig@beanworld.cs.jhu.edu (Jonathan Eifrig) writes:
- |> What is the proper method of closing a socket in order to release
- |> the socket/port binding? Under SunOS 4.1, my application closes its
- |> descriptors and exists. If I immediately execute it again, the bind fails
- |> with errno EADDRINUSE.
-
- This isn't related to how you close the socket descriptor:
- TCP doesn't allow you to re-use a port until (2 * Maximum segment life) time
- has passed. The work around is to use the SO_REUSEADDR socket option. Add that
- to your sample program and you should be able to restart the server immediately
- after killing it. It tells the TCP stack to allow a bind during this "close
- wait" state.
- -
- Kent Hofer hofer@rchland.vnet.ibm.com
- (my opinions are my own and have nothing to do with my employer)
-
-