Multithreading with client server program

前端 未结 2 1865
情书的邮戳
情书的邮戳 2021-01-07 12:29

I am trying to implement multi threading with a client/server program I have been working on. I need to allow multiple clients to connect to the server at the same time. I

2条回答
  •  别那么骄傲
    2021-01-07 13:34

    How many times does serverSocket.accept() get called? Once. That's how many clients it will handle. Subsequent clients trying to contact will not have anybody listening to receive them.

    To handle more clients, you need to call serverSocket.accept() in a loop.

提交回复
热议问题