��¼��TCP���ӵ�״̬

  1. LISTEN:���ȷ������Ҫ��һ��socket���м�����״̬ΪLISTEN. /* The socket is listening for incoming connections. ��������Զ��TCP�˿ڵ��������� */
  2. SYN_SENT:�ͻ���ͨ��Ӧ�ó������connect����active open.���ǿͻ���tcp����һ��SYN��������һ������.֮��״̬��ΪSYN_SENT. /*The socket is actively attempting to establish a connection. �ڷ������������ȴ�ƥ����������� */
  3. SYN_RECV:�����Ӧ����ACKȷ�Ͽͻ��˵�SYN,ͬʱ�Լ���ͻ��˷���һ��SYN.֮��״̬��ΪSYN_RECV /* A connection request has been received from the network. ���յ��ͷ���һ�����������ȴ������������ȷ�� */
  4. ESTABLISHED: ����һ���򿪵����ӣ�˫�����Խ��л��Ѿ������ݽ����ˡ�/* The socket has an established connection. ����һ���򿪵����ӣ����ݿ��Դ��͸��û� */
  5. FIN_WAIT1:�����ر�(active close)��Ӧ�ó������close��������TCP����FIN���������ر����ӣ�֮�����FIN_WAIT1״̬./* The socket is closed, and the connection is shutting down. �ȴ�Զ��TCP�������ж����󣬻���ǰ�������ж������ȷ�� */
  6. CLOSE_WAIT:�����ر�(passive close)��TCP�ӵ�FIN�󣬾ͷ���ACK�Ի�ӦFIN����(���Ľ���Ҳ��Ϊ�ļ����������ݸ��ϲ�Ӧ�ó���),������CLOSE_WAIT. /* The remote end has shut down, waiting for the socket to close. �ȴ��ӱ����û������������ж����� */
  7. FIN_WAIT2:�����رն˽ӵ�ACK�󣬾ͽ�����FIN-WAIT-2 ./* Connection is closed, and the socket is waiting for a shutdown from the remote end. ��Զ��TCP�ȴ������ж����� */
  8. LAST_ACK:�����رն�һ��ʱ��󣬽��յ��ļ���������Ӧ�ó��򽫵���CLOSE�ر����ӡ��⵼������TCPҲ����һ�� FIN,�ȴ��Է���ACK.�ͽ�����LAST-ACK . /* The remote end has shut down, and the socket is closed. Waiting for acknowledgement. �ȴ�ԭ������Զ��TCP�������ж������ȷ�� */
  9. TIME_WAIT:�������رն˽��յ�FIN��TCP�ͷ���ACK����������TIME-WAIT״̬��/* The socket is waiting after close to handle packets still in the network.�ȴ��㹻��ʱ����ȷ��Զ��TCP���յ������ж������ȷ�� */
  10. CLOSING: �Ƚ��ټ�./* Both sockets are shut down but we still don't have all our data sent. �ȴ�Զ��TCP�������жϵ�ȷ�� */
  11. CLOSED: �����رն��ڽ��ܵ�ACK���󣬾ͽ�����closed��״̬�����ӽ���./* The socket is not being used. û���κ�����״̬ */