I have some basic questions about ports and sessions. Since all these are related and simple questions, I've asked them together:
I understand that for creating a connection we need a socket (ip+port) on both client & server. So if one connection is established, then those ports won't be used for other connections, right? But HTTP(80) or SSH(22) is allowing multiple clients to access that port. How?
I read that there is a limitation on the number of ports(~65536) available in a machine. So what does the server need to do if we require more than that (for example, Facebook or Gmail who have a lot of clients)?
I can read how handshake happens before creating a TCP session, but I am not sure how it maintains the connections. For example, if I unplug my ethernet cable, how does my server know that the client lost this connection? Is any pooling mechanism performed between client and server with some interval in TCP connection?