How exactly does a Server Socket work?

Viewed 7385

How exactly does a Server Socket work? When I create a java server socket and accept connection at port 1234. Does the server actually uses the port 1234 for all clients? I've read that when you write a network server the socket actually opens another port once the connection is accepted.

Is this true? If so, why am I not seeing it in netstat? I see a lot of connections like this

tcp        0      0 ::ffff:MY_IP:1234 ::ffff:97.37.134.95:39236   ESTABLISHED 
tcp        0      0 ::ffff:MY_IP:1234 ::ffff:89.204.153.101:26117 ESTABLISHED 
tcp        0      0 ::ffff:MY_IP:1234 ::ffff:195.240.16.70:26193  ESTABLISHED 
tcp        0      0 ::ffff:MY_IP:1234 ::ffff:80.187.98.116:15012  ESTABLISHED 
tcp        0      0 ::ffff:MY_IP:1234 ::ffff:218.78.248.190:30794 ESTABLISHED 

So are they really all connected to my server at 1234? If so, doesn't that mean you the server will be able to accept infinite number of connections?

5 Answers
Related