[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: Hi
From:       Dan Nelson <dnelson () emsphone ! com>
Date:       1998-10-31 6:29:48
[Download RAW message or body]

In the last episode (Oct 31), Alfred Perlstein said:
> On Sat, 31 Oct 1998, Satish Basvapatri wrote:
> > I have one server and many clients. Server listens at a particular
> > port.  The clients themselves acts as servers for other clients and
> > the opeen the connection and never closes them. If the server
> > crashes without closing the socket when I am trying to restart the
> > server I am getting error message "port in user". Can you suggest
> > is there any way to clear up this port?
>
> a) don't write buggy code :)
> b) setup a signal handler,(i assume for SIGSEGV) keep track of all
> sockets and close them in the handler
> c) the client+servers could then catch the SIGPIPE on writes to
> themain server as an indication to try to reconnect in "X" amount of
> time, if the slave servers are performing reads, you should set them
> up to timeout after some time if no data comes across and take it as
> a signal to reconnect.

And the correct answer is of course

d) enable the socket option SO_REUSEADDR.  See the Sockets FAQ at
   http://kipper.york.ac.uk/~vic/sock-faq, sections 4.1 and 4.5.

	-Dan Nelson
	dnelson@emsphone.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic