
Python As the most popular language , A technology that each of us should learn !
This article is for beginners , I will tell you how to get started in the easiest way python!
In the early :

Ethernet : LAN and switch

LAN (Local Area Network,LAN) It refers to a group of computers interconnected by multiple computers in a certain area . It's usually within a few thousand meters . LAN can realize file management 、 Application software sharing 、 Printer sharing 、 Schedule within the working group 、 E-mail and fax communication services . LAN is closed , It can be made up of two computers in the office , It can also be made up of thousands of computers in a company .
IP There are two main functions of the agreement , One is to assign... To each computer IP Address , The other is to determine which addresses are in the same subnet .
What we know about the application of communication between two programs can be roughly divided into two kinds :
The essence of these applications is actually the communication between two programs . These two categories correspond to two software development architectures ~
C/S framework :Client And Server , Chinese meaning : Client and server architecture , This kind of architecture is also from the user level ( It can also be physical ) To divide .
The client here generally refers to the client application EXE, The program needs to be installed before , To run on the user's computer , It depends on the user's computer operating system environment .

B/S framework :Browser And Server, Chinese meaning : Browser and server architecture , This architecture is divided at the user level .
Browser browser , In fact, it's also a kind of Client client , Just this client doesn't need you to install any applications , Just go through HTTP Request server-side related resources ( Web resources ), client Browser The browser can add, delete, modify and check .

The core of networking is composed of a bunch of protocols , Protocol is the standard , For example, the standard of people's communication all over the world is English , If we compare computers to people , Internet protocol is the English language of computer industry . All computers have learned the internet protocol , Then all computers can send and receive information according to the unified standard to complete the communication .
According to the different division of labor, people divide the internet protocol into different levels logically :

Common protocols at each layer :

Socket also called " Socket ", Applications usually go through " Socket " Send a request to the network or answer a network request , To enable communication between hosts or processes on a computer . be based on tcp.
TCP(Transmission Control Protocol) reliable 、 Connection oriented protocol (eg: Make a phone call )、 Low transmission efficiency full duplex communication ( Send cache & Receive cache )、 Byte stream oriented . Use TCP Application :Web browser ; E-mail 、 File transfer program .
UDP(User Datagram Protocol) unreliable 、 Connectionless service , High transmission efficiency ( Little delay before sending ), one-on-one 、 One to many 、 For one more 、 Many to many 、 Message oriented , Do your best to serve , No congestion control . Use UDP Application : The domain name system (DNS); Video streaming ;IP voice (VoIP)
http It's a simple request - Response protocol , It usually runs on TCP above .



Server side
import socket
# establish socket object
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Get the local host name
host = socket.gethostname()
port = 9999
# Binding port number
serversocket.bind((host, port))
# Set the maximum number of connections , Queue up after passing
serversocket.listen(5)
while True:
# Establish client connection
clientsocket, addr = serversocket.accept()
print(" Connection address :{}".format(addr))
msg = ' Chicken, you are so beautiful '
clientsocket.send(msg.encode('utf-8'))
clientsocket.close()
client
import socket
# establish socket object
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Get the local host name
host = socket.gethostname()
# Set the port number
port = 9999
# Connection service , Specify the host and port
s.connect((host, port))
# Receive less than 1024 Bytes of data
msg = s.recv(1024)
s.close()
print(msg.decode('utf-8'))
function

I, a sophomore, earned 8929.6 yuan by taking a part-time job in Python during the holiday
For more than half a year , Th
Using Python to implement an access control management system based on face recognition (with source code)
Project IntroductionAccess con