更新时间:2022-02-21 22:15:38
网上有许多示例.一个快速的Google提出了本教程:
There's any number of examples on the net for this. A quick google brought up this tutorial:
http://programming-guides.com/java/tcp-client-服务器聊天
您需要维护多个连接,每个客户端一个,然后在收到数据后将数据发送到相应的客户端.
You need to maintain multiple connections, one for each client, and send the data to the appropriate clients when you receive it.