If a socket is bound to IN6ADDR_ANY
or INADDR_ANY
and you use a call such as recvfrom()
to receive messages on the socket. Is there a way to find out which interface the message came from?
In the case of IPv6 link-scope messages, I was hoping that the from argument of recvfrom()
would have the scope_id
field initialized to the interface Id. Unfortunately it is set to 0
in my test program.
Anybody know of a way to find out this information?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…