I am trying to understand the Three way handshake in the TCP connection setup.
My book states, the client first contacts the server, say we want an HTTP connection, so it sends a SYN to port 80. (1)
The server then replies a SYN ACK package. (Here is my question) (2)
And now the client sends a final ACK. (3)
In the book the graphic shows, that (2) goes from the server socket back to the initial client scocket . Then the graphic shows that (3) goes from the client socket to a "Welcoming Socket".
The welcoming socket is not the same as the connection socket from (2).
I have downloaded the http.cap from the Wireshark wiki and am taking a look at the initial 3 packets. Here we have the SYN with port 3372 -> 80
then a SYNACK 80 -> 3372
and finaly ACK 3372 -> 80 (with potential Data already).
What confuses me is that the final ACK also goes to port 80 on the server. I thougth that we had created a new Welcoming Socket with a new port, such that the Connection Socket with port 80 can continue listening for new connections.
Best Answer
Your book is talking about system interface for sockets, which is a bit different from real TCP socket.
TCP RFC doesn't say about "welcoming socket".
So, let's look at definitions. From RFC:
So, what is connection?
Ok, so now we need know what is socket. Found:
So TCP socket is just a pair
<address, port>
which can accept connections, which need to be established withthree-way handshake
. Which is send between those two sockets ( and becauseport
is part of socket, there is no welcoming port ).So what is this "welcoming socket"?
Most systems ( eg. Linux ) uses a little more abstract model, that's made to be easier to use for programmers. ( So we don't have to write to the same structure for every connection. )
First we create abstract
socket
that represents our server addr/port ( the so calledwelcoming socket
), and then, when someone connects to it, we get ( via accept() ) from our OS an abstractsocket
that represents our connection betweenclient
andserver
.It does cause some misunderstandings...