Understanding TCP/IP: Port ok to bind
I am trying to understand the tcp socket implementation.
There is a remote server serving at say Port 5000. Now when a linux client tries to open a socket to talk to the server at this port where in kernel code does the socket get bound to a port or rather where does the linux kernel accept a users request(SOCK_STREAM) to open a socket at a particular port and where does it restrict the port numbers to a particular range?
I was already looking at af_inet.c where the socket is getting created. But was a little confused.
Do let me know.