LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Is it possible to use a port for multiple connections ? (https://www.linuxquestions.org/questions/linux-newbie-8/is-it-possible-to-use-a-port-for-multiple-connections-789870/)

vinaytp 02-18-2010 12:50 AM

Is it possible to use a port for multiple connections ?
 
Hello everybody,

Am I right in saying following ?

A deamon say ssh will be listening on port 22. when a new connection is requested by the client, it will be authenticated and a new connection gets establihed with some port say 1025. And ssh will continue to listen on 22 for new connections.

If I am correct then in my machine I observed following connections are establised to ssh port 22, As per my understanding connection should be established on a different port other than 22.

Code:

[vinay@vinay conf]$ netstat -an | grep ESTABL
tcp        0    52 172.17.70.145:22            172.19.31.64:2104          ESTABLISHED
tcp        0      0 172.17.70.145:22            172.19.31.64:2354          ESTABLISHED
tcp        0      0 ::ffff:172.17.70.145:445    ::ffff:172.19.31.64:2692    ESTABLISHED


linuxlover.chaitanya 02-18-2010 12:55 AM

It is the client that used a random port number to communicate on port 22 on the server and you can clearly see that all the ssh connections are to be made on port 22 where ssh daemon is listening.

vinaytp 02-18-2010 12:59 AM

Quote:

Originally Posted by linuxlover.chaitanya (Post 3867755)
It is the client that used a random port number to communicate on port 22 on the server and you can clearly see that all the ssh connections are to be made on port 22 where ssh daemon is listening.

Thanks Chaitanya,

What you mean to say is a port is capable of listening and making multiple connections ?

If so why can't client can make use of same port for both the connections?

linuxlover.chaitanya 02-18-2010 01:14 AM

A connection is not made entirely on the basis of listening port on the server itself. When the connection is established the source of the connection and the source port is also taken into account by the ssh server and it manages the connection on source port and ip.
Does not a web server listen on port 80 and still manages to serve multiple requests?


All times are GMT -5. The time now is 12:17 AM.