- Introduction http protocol
HTTP, HyperText Transfer Protocol. Hypertext Transfer Protocol, is the Internet's most widely used network protocol. TCP-based protocol, HTTP is a client and server side request and response standard - TCP three-way handshake
SYN is synchronization request means, Acronym synchronize (Sync) of the
ACK is confirmed that the synchronization is, Acknowledgment (confirmation) Abbreviation
TCP host transmission control protocol of the host layer provides a reliable connection service
TCP three-way handshake
the first handshake :( client: the server it)?
establish a connection, the client A occurs SYN packet (SYN = j) to server B
and enter SYN_SEND state, waiting for the server B confirms
second handshake :( server: close to, in the,)
server B receives the SYN packet, the client a must confirm the SYN, ACK = j + 1
at the same time he is sending a SYN packet, SYN = k
i.e., SYN + ACK packet, then the server enters a state SYN_RECV
of client :( three-way handshake: I want to send the data)
client a server B receives SYN + ACK packet
sends an acknowledgment to the server B packet ACK (ACK = k + 1)
of this packet been sent, the client and the server a B enters ESTABLISHED state, complete the three-way handshake - TCP four waved process
Client A sends a FIN to close the client A to server B data transmission (segment 4) (Client: I want to shut up).
The server B receives the FIN it sends back an ACK , +1 acknowledgment number of the received sequence number (segment 5). And SYN as a FIN will take a number (server: OK, you receive)
connected to the server A and B closed the client, the client sends a FIN (6 segments) (server A: I have off)
client a sends back an ACK acknowledgment message, the acknowledgment number and the set number plus 1 (segment 7) (client: good, received) - How to reuse the same port server without prompting port is occupied
tcp_server_socket.setsockopt (socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
allow address reuse - str.splitlines () in rows ( '\ r', '\ n', '\ r \ n') separated, it returns a list of elements as each row
Python in the HTTP protocol (notes)
Guess you like
Origin www.cnblogs.com/hewanli/p/11685685.html
Recommended
Ranking