Re: UDP Broadcast uses random source ports
Re: UDP Broadcast uses random source ports
- Subject: Re: UDP Broadcast uses random source ports
- From: Jens Alfke <email@hidden>
- Date: Wed, 31 Aug 2011 00:18:10 -0700
The source port of my outgoing UDP replys seem to change on each broadcast message.
I don’t have an answer to your exact question (been too long since I used UDP), but I can tell you that it’s a bad idea to use broadcast. It will create work for the network interface and IP stack of every single device on the LAN, because every device has to listen to all broadcast packets. This is a bad idea on busy networks.
What you should be using instead is link-local multicast. It has the same basic behavior, except that only network interfaces that are explicitly listening on your multicast address will handle the packet; others can just ignore it. This is how Bonjour works, for example. (And it was Stuart “Bonjour” Cheshire who first explained to me the difference, ten years ago.)
My guess about your port issue is that your code is specifying what port it wants to send *to* on the destination, but it hasn’t specified which port it’s sending *from*.
—Jens
PS: Please don’t BCC the mailing list in your posts. It breaks people’s auto-filtering mail rules, and makes it awkward to reply back to the list. |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden