Forums Register Login

Client-Client Communication

+Pie Number of slices to send: Send
Hi All,


Im fairly new to this socket world, so googled and came across a simple client server mechanism. Here is the link. So, the server waits for the client to connect to it. Now, I have a query. How can I modify the code so that it would help me simulate chating with some other person?. Cant we achieve the same without using the Server [ Server Socket ]?.


Thanks.
Pavan.

+Pie Number of slices to send: Send
There has to be a server listening for you to connect to. (Or an open DatagramSocket that you can send to if you're doing UDP instead of TCP, but it's the same principle.)
+Pie Number of slices to send: Send
Thanks for the response Jeff. But if Im planning to design a chat application in which say two users[ can be many as we know ] can chat, how can that be done? Please shed some info on the same.

Thanks,
Pavan.
+Pie Number of slices to send: Send
The way most chat applications work is that there's a server between the two clients. When you chat with your friends on Yahoo or Skype or Google chat, you each establish a connection to the server, and it relays the messages between you. Note that the server is a server in two different capacities:

1) At the socket level, it is opening the ServerSocket (or other API equivalent) and your chat clients are creating socket connections to that server socket.

2) At the application level, it serves as the relay host that A) has a public IP address and B) knows about accounts and who's online.

It is possible to create a peer-to-peer chat client that doesn't need a server in the sense of #2 above, but for the TCP connection, one end still has to open the ServerSocket as in #1 above. Also note that this approach only works if the server has a public IP address (or receives port forwarding form one) or if both client and server are on the same LAN.
Enjoy the full beauty of the english language. Embedded in this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 4070 times.
Similar Threads
how an Applet can make a socket on local port
Open ports in a huge web application.
socket programming on 2 ports
EJB listening on a client socket for callbacks
Socket Sending and Recieving at same Time?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 04:03:01.