LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (http://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   Bind : address already in use on solaris (http://www.linuxquestions.org/questions/solaris-opensolaris-20/bind-address-already-in-use-on-solaris-392621/)

blackhole123 12-14-2005 12:32 AM

Bind : address already in use on solaris
 
Hello,
I have a SunOS5.9 mac. I have a server process which binds to a specfic port 3000 and to localhost.

The sequence of server execution is like this,
Server starts
socket opened, bind to port 3000
connect
.....
.....

.....
close() the socket

sleep(30);

restart server
during this process the bind fails.

I have verified that the server closes the socket completely(return value of close is 0).

Is this hapening because of the kernel has not completely given up the previous socket resources.

Does changing the tcp_time_wait_interval to 29s will it help...
how to clear the socket resources after the user has closed it.

jlliagre 12-14-2005 05:26 AM

Quote:

I have a SunOS5.9 mac
Really ? Porting Solaris to PPC is still a project ...
Quote:

Is this hapening because of the kernel has not completely given up the previous socket resources.
No, the resources are cleared. This delay is the expected behaviour: a port can't be reused during a defined period, TCP standard mandates 240 seconds if I recall properly.
Quote:

Does changing the tcp_time_wait_interval to 29s will it help...
It should, but you can simply workaround that by using setsockopt() with the option SO_REUSEADDR.

blackhole123 12-14-2005 05:38 AM

Thanks for the reply.
it really solved the problem.


All times are GMT -5. The time now is 11:55 PM.