Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java 2 clients applications communicating with a server

Tags:

java

sockets

I am trying out a simple socket programming example. I was able to run a server application and client application to communicate with each other. I now need to know a tutorial that explains how 2 clients could communicate with each other through the server.

How can I do this ? Can someone point me to a good tutorial or an explanation on how this can be done in Java

like image 757
user1315906 Avatar asked Jun 02 '26 14:06

user1315906


1 Answers

It's not that different and difficult than writing client/server pair. You just have to create threads on server just there, where you accept connections from clients. If your clients should communicate each other, than you surely need a list to store them. And you have to implement, what your server does (communication) in this thread.

Here is a good chat programm tutorial: http://www.dreamincode.net/forums/topic/259777-a-simple-chat-program-with-clientserver-gui-optional/

like image 147
leventcinel Avatar answered Jun 04 '26 02:06

leventcinel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!