Who know the three-way handshake:

enter image description here

But there I have a question, in the 3 steps, will the Host A(Client) and Host B(Server) take resource? I mean the CPU resource and Memory resource.

if there will take resource, which detail step it take?

I heared will create variable, which detail step will create it? such as, is between the Host B SYN received and Send SYN,ACK create variable ?

put on hold as off-topic by Journeyman Geek 2 days ago

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is not about computer hardware or software, within the scope defined in the help center." – Journeyman Geek
If this question can be reworded to fit the rules in the help center, please edit the question.


Both hosts will consume some memory to keep track of the half-open connection as soon as the handshake starts. However, the client will additionally consume some memory as soon as the program initializes the "socket" representing the connection, even before any packet is sent.

Likewise, as soon as the server receives the SYN packet, it'll allocate some memory to keep track of the connection's parameters.

Sending a large number of SYNs to exhaust the server's resources is actually a common attack called a SYN flood. In response to that, some servers have a "SYN-cookie" mode which doesn't keep resources allocated after sending the SYN+ACK response; it can discard the information until the client's ACK arrives, at which point the server begins tracking the connection normally.

From a programming point of view, the entire handshake happens in one step. However, when you're writing a client, the variable representing that connection is assigned before asking the OS to perform the handshake.

conn = socket(AF_INET, SOCK_STREAM)
  # The variable representing the "socket" is initialized and some memory is
  # allocated, but no connection is done yet

connect(conn, address)
  # The entire TCP handshake is performed during connect()

When writing a server, it's the opposite. The "listening" socket is set up first, but each individual received connection is first accepted by the OS (performing the handshake) and only then provided to the program.

conn = accept(listener)

Not the answer you're looking for? Browse other questions tagged or ask your own question.