HTTP server detecting a broken network connection from a HTTP client

前端 未结 2 513
忘掉有多难
忘掉有多难 2021-01-24 05:21

I have an web application in which after making a HTTP request to the server, the client quits ( or network connection is broken) before the response was completely received by

2条回答
  •  渐次进展
    2021-01-24 06:21

    You might have a network problem... usualy, when you send a HTTP request to the server, first you send headers and then the content of the POST (if it is a post method). Likewise, the server responds with the headers and document body. The first line in the header is the status. Usually, status 200 is the success status, if you get that, then there should be no problem getting the rest of the document. Check this for details on the HTTP response status headers http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html

    LE: Sorry, missread your question. Basically, you don't have a trigger for when the user disconnects. If you use OOP, you could use the destructor of a class to clean whatever it is you need to clean.

提交回复
热议问题