连接失败后 FtpWebRequest 不继续
我正在使用 FtpWebRequest
类做一个关于 FTP 文件传输的项目。在传输文件时,如果我的网络连接断开,接收端的文件就会挂起。即使我重新建立网络连接,我也无法进一步处理。一段时间后,该文件被删除;然后我就可以再次放置该文件。问题是什么?班级是这样设计的吗?
接收端是指运行 ftp 服务器的机器,即从没有 FTP 的机器发送文件的人。
I am doing a project on FTP file-transfer using FtpWebRequest
class. While transferring the file, if my network connection gets disconnected the file in the receiving end gets hanged. I am not able to process further even though I re-establish my network connection. After some time the file gets removed; then I am able to put the file again. What is the problem? Is the class is designed in that manner?
Receiving End Means - the machine in which the ftp server runs,and im the who sends the file from a machine without FTP.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在针对什么 FTP 服务器进行编程?我认为是服务器在建立新连接后阻止您操作该文件(该文件应该处于未知状态)。
此外,当网络连接断开时,底层的 WinSock 调用仍然期待来自 FTP 服务器的响应。所以它挂在那里。因此,如果我是你,我会考虑异步调用,如果超时,我可以取消调用。
What FTP server you are programming against? I think it is the server who prevents you from manipulating that file (which should be in unknown state) after building up a new connection.
Also when the network connection is disconnected, the underlying WinSock call is still expecting a response from the FTP server. So it hangs there. So if I were you, I will consider async calls, where I can cancel the call if it times out.