• 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 Broadcasts Don't Work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UDP Broadcasts Don't Work


  • Subject: Re: UDP Broadcasts Don't Work
  • From: Brian Barnes <email@hidden>
  • Date: Tue, 21 Aug 2007 00:24:29 -0400

On Aug 20, 2007, at 10:02 AM, Peter Sichel wrote:

The BSD network stack handles broadcasting a little differently than you
might expect.


To send a generic UDP broadcast, you must set the destination address to
the subnet broadcast address (a subnet directed broadcast). That is, if
your IP subnet is 192.168.0.1/24, you would send to 192.168.0.255 to
broadcast to that subnet. The IP destination will read 192.168.0.255
but the Ethernet MAC address will be the hardware broadcast address.


Since the network stack is multi-homed, sending to 255.255.255.255 makes
it potentially ambiguous which network ports you want to broadcast on
(so in BSD land, the behavior is undefined). In Mac OS 9, Open
Transport would simply copy the packet as needed and send it out every
active network port which made things quite a bit easier.


If for some reason you don't know the correct IP subnet to use, it isn't
configured yet, or can change unpredictably, you may wish to use BPF for
broadcasting similar to "bpftransmit" in the Darwin bootp project (but
you'll need to select the data link and build the UDP header yourself).


In my own experience, bpftransmit has been more reliable. The DHCP
Server in IPNetRouterX (and DHCP Test tool in IPNetMonitorX) need to
broadcasts DHCP queries and responses. I initially used directed subnet
broadcast which worked most of the time, but there were certain obscure
cases where it didn't work as expected because you can't predict what IP
subnets the user might have configured on their machine or how other
network clients will respond. Some users for example might have
Ethernet and Airport interfaces on the same IP subnet with both active
at the same time. Some DHCP clients it appears don't like broadcasts
not addressed to the IP broadcast address (255.255.255.255).


In other words, your title is just about right.  UDP broadcasts don't
work (reliably :-), so you may wish to send raw packets instead.

Hi Peter.

Thanks for the info, I know a bit more now, but still haven't gotten it running. Right now I basically do a couple broadcasts depending on the client's IP. For instance, my client is on a local 192.168.x.x network, so I tried all these broadcasts:

255.255.255.255
192.168.0.255
192.168.255.255

No go, again, it only works if I hit the machine directly (i.e., 192.168.0.3). Could it be the ports? Is there some sort of limit that might be catching me here? I'm broadcasting to port 11802. Again, it works fine if I give it the exact IP. I understand it's unreliable, but I blasted 100 messages at a time just to see if that's what it was and never a hit.

I'm trying to go about this the easy way first :) before I go into the complication of building my own packets or -- a stupid idea but I might be reduced to it -- just flooding the local network with 254 separate pings (not counting any 10.x.x.x or 172.16/32 addresses!) Unreliable or not, I know it's used so it has to be a simple mistake on my part.

[>] Brian
_______________________________________________
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


  • Follow-Ups:
    • Re: UDP Broadcasts Don't Work
      • From: Quinn <email@hidden>
References: 
 >UDP Broadcasts Don't Work (From: Brian Barnes <email@hidden>)
 >Re: UDP Broadcasts Don't Work (From: "Peter Sichel" <email@hidden>)

  • Prev by Date: Re: UDP Broadcasts Don't Work
  • Next by Date: Re: UDP Broadcasts Don't Work
  • Previous by thread: Re: UDP Broadcasts Don't Work
  • Next by thread: Re: UDP Broadcasts Don't Work
  • Index(es):
    • Date
    • Thread