|
Steve, This is from the IBM Infocenter page for the 'setsockopt()' API call, under "usage notes": 6. When a TCP connection is closed for a socket using the AF_INET address family, the port associated with that connection is not made available until twice the Maximum Segment Life (MSL) time in seconds has passed. The MSL time is approximately 2 minutes. The SO_REUSEADDR option allows a bind() to succeed when requesting a port that is being held during this time frame. This can be especially useful if a server is abruptly ended and restarted. You can read the whole thing online at: http://publib.boulder.ibm.com/pubs/html/as400/v4r5/ic2924/info/apis/ssocko.htm Sincerely, Scott Klement Mayor Of The Socket People On Wed, 25 Jul 2001, Steve Richter wrote: > Socket people, > > I am getting an intermitent "socket in use" error in my as400 socket server > pgm as I test my win95 to as400 socket code. > > Even though the shutdown( ) and close( ) functions run without error, the > next time I run my pgm, a "socket in use" error occurs on the Bind( ) stmt. > And NetStat shows my prev use of the socket still in a listen state on the > socket. > > By using SetSockOpt( ), I think I have solved the problem. But varying the > use of shutdown( ) and close( ) also reduced the frequency of the in use > condition. > > My question: Why does the correct use of shutdown( ) and close( ) not always > free the socket? > > Is there some timeout value that can be set? > > Also, is there an api equivalent of NetStat? When my pgm gets an "in use" > return code, can it find out what job is using the socket? > > And, Can my pgm forcefully free up a socket that it knows is not really in > use? > > > Thanks, > > Steve Richter > +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.