Re: Problem with sockets

Alan Cox (
Wed, 4 Dec 1996 21:19:56 +0000 (GMT)

> won't let you bind to that address again because the socket is stuck in one of
> the terminal states (FIN1? 2? CLOSING? I forget...) for 60 (or is it 62?)
> after your app closes the socket. It makes debugging socket-based
> applications really annoying :)
> So what gives? Neither Solaris nor SunOS (the two other OSes I have to use at
> work) behave in this fashion...

They do. Timing patterns may make it seem otherwise.

You should add the following to your application

int one=1;
setsockopt(socket_fd, SOL_SOCKET, SO_REUSEADDR, &one,sizeof(one));