On Sat, Jan 31, 2009 at 3:53 AM, Luciano Afranllie <listas.luafran(a)gmail.com
wrote:
> On Thu, Jan 29, 2009 at 3:04 PM, mayamatakeshi <mayamatakeshi(a)gmail.com>
wrote:
> > Hello,
> > If I start a second instance of kamailio by mistake, if the cfg file
> > instructs it to listen to tcp ports, the second instance will exit with
> > something like this:
> > tcp_init: bind(7, 0x81b28ec, 16) on 127.0.0.1:5060 : Address already in
> use
> >
> > But if the cfg file only instructs kamailio to bind to udp ports, the
> second
> > instance will not exit. Is this a bug?
> >
> > I'm curious because if we start kamailio and a udp port is in use by
> another
> > application (not kamailio), kamailio will exit with
> > udp_init: bind(4, 0x819f274, 16) on 192.168.88.29: Address already in
> use
> > Why is that so?
>
> That behavior may be possible if kamailio is setting SO_REUSEADDR
> socket option for udp but not for tcp.
>
Thanks Luciano,
I didn't know about that.
And you are right. As we can see at udp_server.c:
setsockopt(sock_info->socket, SOL_SOCKET, SO_REUSEADDR , ...
regards,
mayama