Processes, threads, ports, sockets, port state enumeration

Copyright: no copyright, reprint free to https://blog.csdn.net/MAOZEXIJR/article/details/89488614

1. What is the process

Process is the basic unit program fragment execution, resource allocation and scheduling run

 

2. What is the thread

The thread is the smallest unit in the process of performing operations

 

3 difference, process and thread

(1) it can only belong to a thread of a process, but a process can have multiple threads

Dependence between the communication process communication mechanism (2) to maintain the process, the communication between threads via read / write variables to achieve a thread

 

4. What is the port

A host can simultaneously run multiple processes, ports are the only distinguishing mark process

In the network communication, other hosts you want to access the host's a process, we need to know the IP address of the host and port

It's like looking for someone besides him to know where the country provinces + + + Street + cells cities and counties have to know where he's outside the cell house numbers

Here's country cities and counties + + + Province + cells street name  is the IP address, house number  that is port

 

5. What is a socket

Process through software called a "socket" interface message to the network transceiver

Sockets network layer belonging to the concept, understood as IP + port

 

6, port status

CLOSED The socket is not enabled, netstat can not find the state
LISTEN The socket is listening for connections
SYN_SENT Active connection socket has been sent syn, ack each other but did not receive responses
SYN_RECEIVED Has received other syn response, but did not receive ack syn own sent
ESTABLISHED Connection is established
CLOSE_WAIT Remote socket is closed, local socket is waiting close
FIN_WAIT_1 Socket is closed, the connection is shutting down
CLOSING Socket is closed, the remote socket is closed
LAST_ACK Remote socket is closed, waiting for the local socket closed
FIN_WAIT_2  Socket is closed, waits for the remote socket closure
TIME_WAIT This socket has been closed, the socket is waiting for remote shutdown transmission

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Reference material

[1] "process, the difference between the thread" 

[2] "The difference between the socket and the interface"

[3] "Port Status Description, three-way handshake"

 

 

 

 

Guess you like

Origin blog.csdn.net/MAOZEXIJR/article/details/89488614