I have a Java client that uses HttpClient to connect to a server and wait a response. The response may return after a long time (the client essentially waits for an event from the server).
Other than using timeouts, is there a way to detect w开发者_如何学Chen the server crashes?
Considering that a server which has "crashed" cannot be relied upon to send you a message indicating that it has crashed, no.
The solution is to use a timeout, to set an upper limit on the amount of time your client is willing to wait for a request.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论