Which UDP sockets the incoming packet is delivered to when both wildcard and non-wildcard listeners are present

Andrey V. Elsukov bu7cher at yandex.ru
Mon Sep 5 13:48:21 UTC 2016


On 05.09.16 15:42, Maxim Sobolev wrote:
> Suppose we have two threads in the system both bound to a same specific UDP
> port, one using INADDR_ANY and another one using actual IP. When incoming
> message arrives to that port is there any guarantee as to which of those
> two threads going to see the message? The question has arisen from the
> observation that most of the time the thread that is bound to a specific IP
> gets them, but occasionally we see INADDR_ANY-bound thread receiving few
> packets as well. So that behavior seems to be "almost deterministic" and we
> are wondering where that "almost" part is expected or some kind of socket
> matching bug?

Are your sockets connected? I.e. did you use connect+send? And do you
receive unicast datagrams or some broadcast/multicast can appear?

-- 
WBR, Andrey V. Elsukov

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 563 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20160905/f3c6664c/attachment.sig>


More information about the freebsd-net mailing list