I'm looking to write a chat program in Java that would have functionality along these lines.
My question is how would you implement #3? Would you need to make new sockets?
Let the server handle all chats. Make your own "protocols" so your client sends a package containing both the message and destination (user). This can be done with either sending Strings with information you can parse or whole objects. This way it's also pretty easy to create groups with certain users in, all handled by the server.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.