home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / protocol / tcpip / 5131 < prev    next >
Encoding:
Text File  |  1992-11-11  |  1.5 KB  |  30 lines

  1. Newsgroups: comp.protocols.tcp-ip
  2. 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
  3. From: hofer@rchland.vnet.ibm.com (Kent Hofer)
  4. Subject: Re: Proper Method of Closing IP Sockets
  5. Sender: news@rchland.ibm.com
  6. Message-ID: <1992Nov11.192003.28737@rchland.ibm.com>
  7. Date: Wed, 11 Nov 1992 19:20:03 GMT
  8. Disclaimer: This posting represents the poster's views, not necessarily those of IBM
  9. References:  <1992Nov7.034406.19500@blaze.cs.jhu.edu>
  10. Nntp-Posting-Host: data.rchland.ibm.com
  11. Organization: IBM Rochester
  12. Lines: 16
  13.  
  14. In article <1992Nov7.034406.19500@blaze.cs.jhu.edu>, eifrig@beanworld.cs.jhu.edu (Jonathan Eifrig) writes:
  15. |>     What is the proper method of closing a socket in order to release
  16. |> the socket/port binding?  Under SunOS 4.1, my application closes its
  17. |> descriptors and exists.  If I immediately execute it again, the bind fails
  18. |> with errno EADDRINUSE.  
  19.  
  20. This isn't related to how you close the socket descriptor:
  21. TCP doesn't allow you to re-use a port until (2 * Maximum segment life) time 
  22. has passed.  The work around is to use the SO_REUSEADDR socket option.  Add that
  23. to your sample program and you should be able to restart the server immediately
  24. after killing it.  It tells the TCP stack to allow a bind during this "close 
  25.  wait" state.
  26. Kent Hofer             hofer@rchland.vnet.ibm.com
  27. (my opinions are my own and have nothing to do with my employer)
  28.  
  29.