Python | Network Communication Concepts


To put it simply, the network is to use physical links to connect isolated workstations or hosts together to form data links, so as to achieve the purpose of resource sharing and communication.

The purpose of using the network is to connect multiple parties and then communicate, that is, to transfer data from one party to another.

The programs written in the previous study are all stand-alone, that is, they cannot communicate with programs on other computers. In order to allow software running on different computers to transmit data to each other, it is necessary to use the function of the network.

Using a network to link multiple parties together, data can then be transferred
The so-called network programming is to allow software on different computers to transfer data, that is, communication between processes
ip address
An address in life is a designated place to find or communicate with someone or an agency. In network programming, if a host wants to communicate and share data with another host, the first thing to do is to find each other. In Internet communications, we use IP addresses to query individual hosts.

ip address: used to mark a computer in the network, such as; it is unique on the local area network.

Classification of ip addresses

Each IP address consists of two parts: the network address and the host address. The IP address is usually represented by dotted decimal (for example:, and the IP address should be used in conjunction with the subnet mask (used to distinguish the network bit and the host bit).

Class A address
A class A IP address consists of a 1-byte network address and a 3-byte host address. The highest bit of the network address must be "0".

Address range:

Subnet mask:

The binary representation is: 00000001 00000000 00000000 00000001 - 01111110 11111111 11111111 11111110

There are 126 Class A networks available, each of which can hold 1,677,214 hosts

Class B address
A class B IP address consists of a 2-byte network address and a 2-byte host address. The highest bit of the network address must be "10".

Address range:

Subnet mask:

The binary representation is: 10000000 00000001 00000000 00000001 - 10111111 11111111 11111111 11111110

There are 16,384 Class B networks available, and the maximum number of hosts supported by each network is 256 to the power of 2 - 2 = 65,534.

Class C address
A class C IP address consists of a 3-byte network address and a 1-byte host address, and the highest bit of the network address must be "110"


Subnet mask:

The binary representation is: 11000000 00000000 00000001 00000001 - 11011111 11111111 11111110 11111110

Class C network can reach 2097152, and the maximum number of hosts supported by each network is 256-2=254

Class D address
The first byte of a class D IP address starts with "1110". It is a specially reserved address and does not point to a specific network. Currently, this class of addresses is used in multicast (Multicast).

Class E address
Starting with "1111", reserved for future use only for experimental and development purposes.

private address
Among so many network IPs, some IP addresses are used in our local area network according to international regulations, that is, they belong to the private network IP and are not used in the public network. Their scopes are:


An address where each byte is 0 ("") corresponds to the current host.
An IP address where each byte in the IP address is 1 ("") is the broadcast address of the current subnet.
All class E IP addresses starting with "1111" are reserved for future and experimental use.
The IP address cannot start with decimal "127". The numbers to in this type of address are used for loopback testing. For example, can represent the local IP address. can test the Web server configured in this machine.
The first octet of the network ID also cannot be set to all "0", all "0" means the local network.

Related Articles

Explore More Special Offers

  1. Short Message Service(SMS) & Mail Service

    50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00

phone Contact Us