How can I tell if the connection has been broken in my sockets based client?

前端 未结 6 1038
小鲜肉
小鲜肉 2020-12-11 18:11

If my client\'s connection is broken on the other end( kill -9 server). It takes several minutes for the client to determine that something is wrong. Sock

6条回答
  •  时光说笑
    2020-12-11 18:29

    Spawn another thread that is constantly pinging the server - really the best you can do since a socket is not an active connection.

提交回复
热议问题