i had a problem when using the bind function.. that is when i create a socket and bind it with a address(usually some file name)... when i run it once it goes on fine but the second time it tells a error since there is already a socket file in that name created by my previous run...
but when i use a tcp/ip method, i cant see the socket file at all.. where is that one created..?
Is the previous socket properly close()d? If not, there might be an interval during which the socket may still be "occupied" until it times out. I experience this a lot with server sockets.
Ever notice that inetd never has this problem? Here is the source code for the Solaris version of inetd. It does its bind() in the routine called "create_bound_socket" (lines 653 - 724) The "secret" is line 671 which is a call to setsockopt to turn on SO_REUSEADDR.
As long as no process currently is using the port, this is all it takes.