從 google 上找 tcp flow 的圖, 就從 IBM 的網站上挖到這個很清楚的圖

TCP connection flow
TCP connection flow

以下為第順序的說明

The following sequence shows the flow of a TCP connection:

  1. The server creates the listener socket that is waiting for remote clients to connect.
  2. The client issues the connect() socket function to start the TCP handshake (SYN, SYN/ACK, ACK). The server issues the accept() socket function to accept the connection request.
  3. The client and server issue the read() and write() socket functions to exchange data over the socket.
    Note: There are several SSL APIs that you can use to send and receive data other than the read() and write() socket functions.
  4. Either the server or the client decides to close the socket. This causes the TCP closure sequence (FINs and ACKs) to occur.
  5. The server either closes the listener socket or repeats beginning with step 2 to accept another connection from a remote client.
    Note: Normally after the accept() socket function ends, the server divides into two processes (or threads). The first process handles the connection with the client and the second process issues the next accept() socket function.

ref: http://publib.boulder.ibm.com/infocenter/tpfhelp/current/index.jsp?topic=/com.ibm.ztpf-ztpfdf.doc_put.cur/gtps5/s5tcpcf.html

發表迴響

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料

Verified by MonsterInsights