How to use UDP to broadcast across a network segment

Source: Internet
Author: User

Original link Address: http://blog.chinaunix.net/uid-22670933-id-3716646.html

Broadcast Domain

First, let's take a look at the concept of broadcast domain.
A broadcast domain is a collection of all hosts in a network that can receive broadcast frames from either host. That is, if one of the hosts in the broadcast domain issues a broadcast frame, all other hosts in the same broadcast domain can receive the broadcast frame.

calculation of broadcast domain

How do I know which broadcast domain A host belongs to? In fact, the calculation is very simple, as long as the host's IP address and subnet mask with the operation to know the host belongs to which broadcast domain. For example, a host has an IP address of 192.168.23.150, a subnet mask of 255.255.255.0, and the broadcast domain to which it belongs is 192.168.23.150&255.255.255.0=192.168.23.0. Then all other hosts within the broadcast domain 192.168.23.0 can send a broadcast packet to that device. If the mesh mask is changed to 255.255.0.0, then the broadcast domain to which it belongs is 192.168.23.150&255.255.0.0=192.168.0.0. Then all other hosts within the broadcast domain 192.168.0.0 can receive broadcast packets sent by the device.

calculation of broadcast address

To be able to receive broadcast frames from other hosts in the same broadcast domain, you also need to specify the broadcast address in the broadcast domain that is currently owned when the broadcast packet is sent. The broadcast address is computed as the subnet mask inversion and the broadcast domain.
For example, if the host currently owns a broadcast domain of 192.168.0.0, the subnet mask is 255.255.0.0, then the broadcast address is 192.168.255.255.

cross-network segment broadcast using UDP

For a broadcast packet sent by host A to be received by Host B of another network segment, only the subnet mask of host a needs to be changed so that the broadcast packet can be sent with Host B in the same broadcast domain and the broadcast address of the new broadcast domain.

For example: To send a broadcast packet using 192.168.23.150 for 192.168.27.135 to receive, just set the 192.168.23.150 subnet mask to 255.255.0.0, and then use the broadcast address 192.168.255.255.

In particular, 255.255.255.255 is a restricted broadcast address and cannot be used to send broadcast packets.

How to use UDP to broadcast across a network segment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.