From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII X-Google-Thread: fa528,1fc375d2a9428780 X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2002-05-28 07:45:09 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: sriedl@ncube.com (Steve) Newsgroups: comp.unix.tru64 Subject: Re: Reconnect to TCP/IP port that was previously in use Date: 28 May 2002 07:45:08 -0700 Organization: http://groups.google.com/ Message-ID: References: <4b9e0387.0205280018.5202837f@posting.google.com> NNTP-Posting-Host: 134.242.29.107 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1022597109 11394 127.0.0.1 (28 May 2002 14:45:09 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 28 May 2002 14:45:09 GMT Xref: archiver1.google.com comp.unix.tru64:7817 choefe@gmx.ch (Rolf Huebscher) wrote in message news:<4b9e0387.0205280018.5202837f@posting.google.com>... > We have connections between two Unix (Compaq Tru64 4.0F) machines > using TCP/IP. The connections are always closed and reopened. However, > when trying to reopen a port that was previously in use, this will not > work for some time. This time is said to be configurable somewhere, > but we don't know where. > > Anybody who knows this? > > Note : the following did NOT solve the problem : "I understand you > have an application program that needs open that port > and it can�t do it because is still in use. Try to open the port with > the "SO_REUSEADDR" option for the socket. You can set this option with > the "setsockopt" call." I've tried various methods to speed this up, but TCP has some rules that it is actually never supposed to take down a socket, so there are qute a few workarounds that are already in the code. I have found it takes about a minute to get a socket back in my application. Best option if you can is to nail up the socket and not open and close it all the time. It seems to be either this or live with it. There are some parameters in sysconfig for tcp and sockets, but I have found them to be very ineffective at actually changing this behaviour. Some of these are tcp_keepalive_default = 1 tcp_keepinit = 30 tcp_keepidle = 30 tcp_keepintvl = 30 tcp_keepcnt = 2 socket sominconn = 65535 somaxconn = 65535 I have also occasionally tried the REUSEPORT attribute, but that is a good way to get the system to hang (quite hard as I have found out)