通过http发送文件时,连接失败会发生什么? [英] while sending file through http,connection failure occurs what happen?

查看:144
本文介绍了通过http发送文件时,连接失败会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



i开发了一个窗口应用程序来通过http上传文件。

现在我怀疑是否在发送过程中发生连接失败文件会发生什么?是否可以通过http发送剩余的连接失败后?



请提前清除我的疑惑。谢谢。

dear all,

i have developed window application to upload files through http.
now my doubt is if connection failure occurs during sending files what happens?is it possible to send the remaining after connection failure through http?

please clear my doubts.thanks in advance.

推荐答案

这是不可能的。这背后的原因是http是无状态协议。当我们通过http发送任何请求时,它只为该请求创建一个临时会话和维护状态。与服务器断开连接后,服务器上的所有信息都会因状态而丢失。开发人员必须手动管理状态。





在这种情况下,当您发送文件时,文件上传到数据包和服务器将其保留在内存中,直到没有上传完整的文件。收到后如果连接中断,服务器释放内存和上传的内容将丢失。



必须再次上传。



我希望这会回答你的问题。如果您需要更清楚,请告诉我。
It is not possible. The reason behind this is that http is a stateless protocol. When we send any request over http it creates a temporary session & maintain state for that request only. Once connection with server break, all the information on server is lost regarding state. The developer has to manually manage the state.


In this case when you are sending a file, the file uploaded in packets & server keeps it in memory till complete file is not uploaded. After receving If connection break, the server release memory & anything uploaded will be lost.

It is mandatory to upload once again.

I hope this would answer your query. Let me know if you need more clarity on this.


这篇关于通过http发送文件时,连接失败会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆