Subject: [SWIPL] tcp_socket and REUSEADDR

From: "Leonid V. Khramov" <[email-masked]>
Date: Thu, 27 Sep 2001 12:57:37 +0400 (MSD)

Hi!

First of all thanks for fixing bug in wait_for_it, it works fine now.

And i have another problem in tcp library.
When i open socket for server use , tcp library didn't set SO_REUSEADDR
option on soket. So if server crashes and restarts it can't allocate socket
again because address still in use (OS wait some timeout).

For fix this problem in C, you need to call:
if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,&val,sizeof(val))==-1)
{
  return(tcp_error_term(errno, NULL));
}

after creating a socket.

I hope this helps to fix the problem.
Thank you.
-- 
Best regards,
Leo <[email-masked]>
Solvo Ltd. 
St.Petersburg, Russia