On 31 Aug 2011, at 08:05, email@hidden wrote:
> The source port of my outgoing UDP replys seem to change on each
> broadcast message.
The issue here is that you're creating a new socket each time you send a broadcast, and you're not explicitly binding the socket to a specific port. When you send from an unbound socket, the TCP/IP stack binds the socket to a anonymous port (on Mac OS X this is in the range 49152..65535). If you reused the socket, that'd be fine; the socket would then be bound and you'd get the same source part. But you are re-creating the socket each time, so this process is applied each time, so every send comes from a different port.
You might want to look at the UDPEcho sample code, which shows my recommended way of dealing with UDP in a typical Mac OS X or iOS app.
What are you doing with broadcasts? As Jens said, avoiding broadcasts will make everyone's life better. My guess is that you're talking to some embedded hardware, in which case this would be a good opportunity to nag your vendor about supporting Bonjour.
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
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