TCP Network - Manually program SYN, SYN ACK, ACK?
<p>If you were writing a basic python TCP server and client would you need to add the SYN, SYN ACK and ACK responses yourself or is it taken care of by the socket module?</p>

<p>If you need to write it yourself would it be as simple as something like this?</p>

<p>Client:</p>

<pre><code>#set up clientSocket

data = "SYN"
clientSocket.send(data.encode('utf-8'))
if((clientSocket.recv(1024)).decode('utf-8') == "SYN ACK") {
  data = "ACK"
  clientSocket.send(data.encode('utf-8'))
}
</code></pre>

<p>and the Server responding in a similar way with checking if recv is SYN and then send SYN ACK. If not what is the correct way of implementing it?
Haven't ran the above code, not bothered about the syntax being 100% correct just curious about the logic behind it</p>