Henry Wong wrote:
The answer is... it depends. Are you proposing that both clients implement a server socket, and nothing else? Or are you proposing that they also use a socket to connect to each other's server socket, or if there is a third party that connects to the server sockets?
Henry
Muztaba Hasanat wrote:
To listen from a certain socket I do I have to implement ServerSocket? Or the general socket can listen from a socket? The problem is I am not understand what is the point to make a server in a chat program.
Henry Wong wrote:
Muztaba Hasanat wrote:
To listen from a certain socket I do I have to implement ServerSocket? Or the general socket can listen from a socket? The problem is I am not understand what is the point to make a server in a chat program.
Do you understand the difference between the rendezvous socket and the data sockets? Once a data connection is established, with a connection of a socket from one end, and the socket returned from the server socket on the other end, communication is full duplex. Both sides can write to the data sockets, and both sides can read.
The ServerSocket class implements the rendezvous socket. It is *not* for data. It is to establish the data sockets... so, no ServerSocket, means no data sockets, means no communications.
Henry
Paul Clapham wrote:It's possible that you have decided that the purpose of a chat application is to allow two people to chat. And I suspect you haven't noticed another requirement, namely that the two people need to be able to find each other first. How do you plan to do that?
Muztaba Hasanat wrote:
So considering the simplest chat program that is two clients in two pc. This two clients have to implement ServerSocket in both end and they are listening each other for connection request. Is this right ?
Muztaba Hasanat wrote:
And if there is a server between this two clients then also those two clients have to implement ServerSocket for any connection request from server. Is this right ?
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |