socket already in use error on server

Konstantin Olkhovskiy lupus at
Thu Jun 20 08:48:58 CEST 2013

I would say that socket binding does not sound like the right way to block
second instance from running.
You could just flock() the pid file (or some special lock file if you do
not have the pid file in place) upon start.

2013/6/20 fatmck <fatmck at>

>  SO_REUSEADDR will not allow you listen twice at the same time. you will
> get an error of EADDRINUSE when you try to listen a second time on the same
> address.
> SO_REUSEADDR only allow you to reuse the address after you close the
> socket immediatelly.
> 于 2013年06月20日 11:29, Neeraj Rai 写道:
>  I forgot to mention,
> SO_REUSEADDR is not an option for me as I don't want two instances running
> at the same time.
>  thanks
> Neeraj
> Date: Thu, 20 Jun 2013 09:58:55 +0800
> From: fatmck <fatmck at>
> To: libev at
> Subject: Re: socket already in use error on server
> Message-ID: <51C261DF.10305 at>
> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
> you can google SO_REUSEADDR socket option. this option will allow you
> reuse the address.
> _______________________________________________
> libev mailing list
> libev at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the libev mailing list