Java: Detecting client disconnects from server side

前端 未结 1 1174
攒了一身酷
攒了一身酷 2021-01-14 15:20

I am writing a Java client/server program using Socket and ServerSocket. Multiple clients connect to the server at once. What is the best way to check if a client connection

相关标签:
1条回答
  • 2021-01-14 16:04

    The best way to detect a disconnection is to have the other end send a heartbeat and have the reader timeout when there is no data.

    0 讨论(0)
提交回复
热议问题