好办法,在C#中的网络发送大文件? [英] Good way to send a large file over a network in C#?

查看:136
本文介绍了好办法,在C#中的网络发送大文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个可以从网络中的另一台机器上运行的服务请求文件的应用程序。这些文件可以是相当大的(有时500MB +)。我一直在寻找到通过TCP发送,但我很担心,这可能要求整个文件存储在内存中。

I am trying to build an application that can request files from a service running on another machine in the network. These files can be fairly large (500mb + at times). I was looking into sending it via TCP but I'm worried that it may require that the entire file be stored in memory.

有可能只有一个客户端。复制到共享目录是不能接受的要么。唯一需要的通信是客户说给我XYZ,服务器发送它(并不惜一切代价确保发生这种情况正常)。

There will probably only be one client. Copying to a shared directory isn't acceptable either. The only communication required is for the client to say "gimme xyz" and the server to send it (and whatever it takes to ensure this happens correctly).

有什么建议?

推荐答案

下面是一个更简单的方法。使用BITS(后台智能传输服务)。它已经内置的WinXP和Vista。它基本上是什么驱动Windows更新。

Here is an easier way. Using BITS (Background Intelligent Transfer Service). Its already built into WinXP and Vista. Its basically what drives Windows Updates.

http://blogs.msdn.com/powershell/archive/2009/01/11/transferring-large-files-using-bits.aspx

http://blogs.msdn.com/jamesfi/archive/2006/12/23/how-to-use-bits-to-transfer-files.aspx

下面是一个很好的管理BITS包装有人写,以及如何使用它。

Here is a nice managed BITS wrapper someone wrote and how to use it.

HTTP:// WWW。 codeproject.com/KB/cs/Managed_BITS.aspx

这篇关于好办法,在C#中的网络发送大文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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