• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: UDP responses and listeners
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UDP responses and listeners


  • Subject: Re: UDP responses and listeners
  • From: "Quinn \"The Eskimo!\"" <email@hidden>
  • Date: Tue, 27 Jul 2010 10:23:30 +0100

On 27 Jul 2010, at 06:27, Jeff Davey wrote:

> So close...  I've used two UDP terminal programs that get the replies fine.  So I think there might be something I can do in the code to get the replies even when it is broadcast to 255.255.255.255.  I did try binding the socket to 255.255.255.255.  It didn't catch any replies.

This is a standard TCP/IP gotcha.  If you bind a socket to a specific address, you only receive traffic for that address.  So, if you bind to 192.168.1.100, you only receive traffic to 192.168.1.100.  Broadcast traffic is sent to 255.255.255.255, so you don't receive it.

In mind cases the correct solution is to bind to INADDR_ANY (0.0.0.0).  That should be true for all of your sockets.  Unless you want to control which of the machine's IP addresses is used for sending (something that can be useful, but probably not in this case), just bind your socket to INADDR_ANY.

S+E
--
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

References: 
 >Re: UDP responses and listeners (From: Jeff Davey <email@hidden>)

  • Prev by Date: Re: UDP responses and listeners
  • Next by Date: iphone to mac ..
  • Previous by thread: Re: UDP responses and listeners
  • Next by thread: iphone to mac ..
  • Index(es):
    • Date
    • Thread