0

In TCP, a socket is identified by a 4-element tuple (source ip, source port, destination port, destination ip). This is easy to understand when it comes to a Socket object. However, on server side we always define a welcomingSocket which is an instance of ServerSocket. Is this ServerSocket a real socket like Socket which is also identified by the 4-element tuple? From my perspective, it is not a socket but just happened to be called "ServerSocket". Am I right?

  • A socket is just identified by the ip and port. Only a connection is identified by four elements. Think of a connection as a cable that plugs into two sockets. And yes, a ServerSocket is a specialized socket. – NomadMaker Mar 11 '21 at 10:13
  • 1
    Does this answer your question? [What is the difference between Socket and ServerSocket?](https://stackoverflow.com/questions/2004531/what-is-the-difference-between-socket-and-serversocket) – Dren Mar 11 '21 at 10:14

0 Answers0