Python Network Programming Fundamentals-Basic knowledge of the network and the basic introduction of the transmission mode UDP

Source: Internet
Author: User

Network programming: UDP

to understand network programming, you first need to understand what a network is (understand):
Network definition: The network refers to the independent function of multiple computers through the communication line, in the network management software and network communication protocol, the realization of resource sharing and information transmission virtual platform.
Popular can be understood as: is the two or more devices connected together a tool, and then can be transmitted data.
# 1, IP address:
An IP address is like a home address, where you can send a message by locating the only device in the network via an IP address. (Addresses are IPv4 and IPv6)
Locate the only device in the network with an IP address, and then send the data to the device.
Private IP (understanding):
The private IP is the IP address used in the LAN, and some IP addresses are used in the local area network:
Native IP address: represents the native IP address; The native domain name is localhost; Through the domain name can be resolved an IP address, domain name convenient for everyone to remember the host address of a computer
2,ifconfig (ipconfig) To view the native IP in the terminal.
3, Ping can check whether the network is normal
(1). ping Check if the local network adapter is healthy
(2). Ping Check if you can get on the public network
(3). Ping the IP address of the current local area network check if it is within the same LAN
4, Port:
A port is a channel that transmits data, like a classroom door.
5, port number:
Using a unique number to identify the port is actually a number for the port, such as qq4000
well-known port number (understanding):
The well-known port number is a well-known port number, ranging from 0 to 1023, which can be understood as the number used for some commonly used functions is estimated, like phone numbers 110, 10086, 100,101
Dynamic port number (Learn):
A programmer develops an application that uses a port number, which is called a dynamic port because it is generally not assigned a service, but is dynamically allocated, and the port range is from 1024 to 65535. When the program shuts down, it also frees the port number that is occupied.
5. View port number:
Use Netstat-an to view the port number used by the program
Lsof-i [tcp/udp]:2425 View the application for the port number
Tip: If the port number cannot be found for the application, use Administrator privileges plus sudo
After you find the application for the port number, you can use the kill-9 number if you want to end the process. Kill process
6, the flow of network communication:
The process of network communication is to find the device in the network through the IP address, then find the corresponding port by the port number, then transmit the data to the corresponding application via the ports.

Network transmission mode UDP:

UDP: English full spell (user Datagram Protocol) referred to as Subscriber Datagram Protocol, it is a non-connected, unreliable network transport protocol
1, UDP Features:
No connection
Low resource overhead
Fast transmission speed
UDP maximum per packet is 64K
2, UDP disadvantage:
Unreliable transmission data, easy packet loss
No traffic control, when the other party does not receive data in a timely manner, the sender has been sending data will cause the buffer data is full, the computer is stuck, all receivers need to receive data in time
3, Summary:
UDP is a simple transport-layer protocol for datagrams. UDP does not provide reliability, it simply sends the application to the IP layer's datagram, but does not guarantee that it will reach its destination. Because UDP does not have to establish a connection between the client and the server before transmitting the datagram, and there is no mechanism such as time-out retransmission, the transmission speed is very fast.

Python Network Programming Fundamentals-Basic knowledge of the network and the basic introduction of the transmission mode UDP

Related Article

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: 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.