ServerSocket vs Socket
807606Mar 1 2007 — edited Mar 2 2007Hi,
I'm not sure what the clear difference between a ServerSocket and a Socket is. Sure I know that you're supposed to use one for a server and one for a client, but what's the difference between them functionally?
Also, I'm creating a client-server program which, in terms of networking, should work just like a chat program. Now the only way I can think of having the clients of this program to be aware of any new chat messages sent by other clients is to have them constantly listening to the server. In that case, are they all servers? Should I be using the ServerSocket for all of them?
Finally, when I create a Socket, I supply it with a port number. Is this the port number of the client that's connecting, or the number of the server that it's trying to connect to? If it's the number of the server, then where do you define what port number the client uses?
Any help would be greatly appreciated...