Sending a message to all clients (Client - Server communication)

前端 未结 3 2029
北海茫月
北海茫月 2020-11-29 04:29

So now, I am making a client server app based multithread. In server side, I make a thread for everysingle connection that accepted.

In thread class, I make a method

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-29 04:51

    There is no method in server socket to send data or message to all running clinet threads. Please go through the ServerThread.java program which is calling the sendToAll usng server.

    // ... and have the server send it to all clients
    server.sendToAll( message );
    

提交回复
热议问题