TCP Handshake and port numbers

Posted by Guido on Server Fault See other posts from Server Fault or by Guido
Published on 2012-11-11T19:50:19Z Indexed on 2012/11/11 23:02 UTC
Read the original article Hit count: 290

Filed under:
|

(I have a question about the TCP handshake and how port numbers are assigned, if this does not belong here, let me know.)

Hi, I'm studying TCP/IP from the book "Internetworking with TCP/IP" by Douglas Comer. In the TCP chapter it mentions that TCP defines an "endpoint" as a pair (IP address, port number), and a connection is defined by two endpoints.

This has a few implications, such as, a local TCP port could be in several connections at once, as long as there are no two from the same IP and the same remote port. This also means that the amount of established connections is almost limitless (2^16 for every IPv4 address. 2^48 in total).

Now, in class, I was told that when one connects to a listening port, both sides agree on a different port to use, so the communication can happen and the listener socket remains free. This was also my belief before reading the book.

Now I feel like I should obviously trust the book (It's Comer!), but is there any truth to the other explanation?

Thanks

© Server Fault or respective owner

Related posts about networking

Related posts about tcp