[ntp:questions] ipv6 support on linux - bind problem

Uwe Klein uwe_klein_habertwedt at t-online.de
Mon Apr 9 16:18:32 UTC 2007


Wolfgang S. Rupprecht wrote:
> Uwe Klein <uwe_klein_habertwedt at t-online.de> writes:
> 
>>does this look any different when you do a :
>>
>>	setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,.....
>>
>>before any binding to that local port?
> 
> 
> That is a good question, but no it doesn't seem to help.
> 
> I always have those REUSEADDR lines in all my personal code and it
> didn't help here.  REUSEADDR seems to only help when you restart the
> daemon and the old socket still has connections in timed waits.  (I
> suppose that means it only does anything for TCP, which is where I was
> introduced to the problem.)
you need it if you have more than one multicast App on the same host.
with REUSEADDR all incoming (multicast) packets are muxed to all apps
listening on that port(
( I use that for distributed, restartable and migratable stuff)
> 
> Thinking about it from a different angle, I don't see how the kernel
> could ever allow two wildcard binds on the same address and port.  For
> incoming packets, it would have no way to tell which of the two
> sockets to send a packet to.  If subsequent packets when to different
> ports then the reassembly of multi-packet messages would be impossible
> without lots of retransmissions.  It would look like a 50% packet loss
> rate, which is effectively unusable.
Unusable for TCP but for UDP you would mux all packets to all listeners.
> 
> -wolfgang

uwe




More information about the questions mailing list