开发者

implementing HTTP reliability

开发者 https://www.devze.com 2023-02-09 01:09 出处:网络
My application is a desktop client and a web API application.I am writing both programs. Does the internet discard old requests?开发者_StackOverflow社区Does it make a difference if it is just an old

My application is a desktop client and a web API application. I am writing both programs.

Does the internet discard old requests?开发者_StackOverflow社区 Does it make a difference if it is just an old request or a duplicate request?

Is retrying HTTP requests the only way to ensure almost complete end-to-end reliability over HTTP or is there someway to achieve SOAP-level reliability by just setting arguments or headers without using SOAP? My app is not using SOAP, just Python standard library synchronous requests (multi-threaded).


HTTP is usually not the most ideal option for this. You send a single request after which the connection is broken.

Then again, HTTP uses TCP. TCP will allow you to wait for a response that will tell you if the server has received all information as opposed to UDP which is fire & forget.

So the TCP layer is secure enough. HTTP is a request/response protocol. After the response, the connection is closed. There are features for 'keep-alive' connections, but these don't work on all servers. You typically can't rely on that.

If HTTP is the right protocol depends on the situation:

If

  • application only sends a request once in a while
  • server doesn't need to send information back on its own, but only in response to a request
  • others ports/protocols are no option due to firewall settings

then

HTTP is the right way to go. If any of the statements above are false, you might better use a different type of TCP protocol.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号