Accepting UDP broadcasts

Top  Previous  Next

UDP datagrams can be sent as broadcasts. Broadcast, instead of specifying a particular network host as a destination, targets a group of hosts on the network.

 

note_tip-wt

The sock object supports link-level broadcasts. Such broadcast packets have their destination MAC address set to 255.255.255.255.255.255. Link-level broadcasts are received by all network hosts connected to the current network segment. Link-level broadcasts cannot penetrate routers, bridges, etc.

 

For the socket to accept incoming UDP broadcasts, the sock.acceptbcast property must be set to 1- YES. In every other aspect working with incoming broadcast UDP datagrams is like working with regular incoming datagrams.