Comment 7 for bug 930513

Revision history for this message
Russell Bryant (russellb) wrote :

The code is a little bit misleading, but I have seen this pattern used elsewhere. No traffic is actually sent here at all since it's a UDP socket. The connect() call is necessary so that the IP stack will choose a source IP address. Then, getsockname() will work. This code is basically "If I were to send traffic to something out on the Internet, what source IP address would I be using". I don't really know a better way to accomplish it.

I don't consider this is a bug. Thanks for bringing up the possible concern, though.