Doing a "netstat -a" shows that the port is in a TIME_WAIT state.
After a few minutes, the port number can be reused. We suspect that
the order in which the two processes close the socket might be a
factor.
As it stands right now, we don't want to use a new port every time
the processes run.
This did not happen under SunOS. It is driving our automated tests
nuts that run and kill these processes over and over.
Has anyone else seen this? Is there some socket option I can set to
get around this?
Thanks for your help..Mary
: Thanks for your help..Mary
Mary,
I have had this problem under both 4.1.x and Solaris 2.x. When our map
server dies abnormally ( core dumps :-> ) its socket remains busy for one
minute. The server behaves the same way under 4.1.x. I have not found any
solution for this problem (the server must stay at a known port number
and RPC is TOO slow), and I would really be interested in any fixes.
Good luck, Jeff.
P.S. We have recently moved to 2.3 (Parallax took for ever to release
drivers for their video card) and have begun to see serval extra bytes
slipping into the data stream of two connected sockets. Seams to happen
when during periods when clients are sending large packets in large
numbers per second. Is anyone else having similar problems ?
int reuse_opt = 1;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse_opt,
sizeof (reuse_opt)) < 0)
{
perror ("sock-fail");
}
(Tom Steger [ste...@tautron.com] )
>We are currently porting a SunOS application to Solaris that
>consists of two processes that communicate over a socket. When the
>processes are killed, the port number cannot be reused for a while.
>Doing a "netstat -a" shows that the port is in a TIME_WAIT state.
>After a few minutes, the port number can be reused. We suspect that
>the order in which the two processes close the socket might be a
>factor.
I have been having the same experience.
I only seems to happen when the server side disconnects before the client.
If your client can do the hanging up it should be ok.
I have tried everything else that I could think of, including using
the shutdown(3n) command...
Someone else posted about the reuse-address stuff, I don't think you should
have to do this though. I believe it is a bug.
Pat
We solved this problem by using setsockopt to set SO_REUSEADDR which
makes the socket available the next time you need to bind to it.
Apparently this is part of the TCP protocol.
-Tim Carlson
tcar...@qualcomm.com
It's the 2MSL (maximum segment lifetime) wait.
For questions like this, I highly recommend W. Richard Stevens' book
"TCP/IP Illustrated, Volume 1: The Protocols". The 2MSL wait is
described on page 242 of this book. It is probably also covered in
his book "UNIX Network Programming", another book I highly recommend.
-Jonathan h...@island.com