This doubt has been there in my mind regarding socket-port relationship that whether a port is associated with only one unique socket object or multiple socket objects can be associated with a single port?

Simon Ablett

As I understand it, you can have any number of Sockets associated with a host:port combination and only a single ServerSocket. At least this is how it works in the Client-Server stuff I write :-) The Client's each open a socket connection against the specified host:port. Whilst the server waits in the accept method of the ServerSocket (on that host:port) and then creates a new Socket object whenever accept returns (usually I'd then create a seperate thread to monitor each new socket).End result: single ServerSocket, multiple Sockets.

About | Sitemap | Contact