Good way to send a large file over a network in C#

2019-03-28 19:05发布

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.

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).

Any suggestions?

10条回答
三岁会撩人
2楼-- · 2019-03-28 19:26

If files exist physically on the machine why not just put them in a folder, make that folder a virtual directory in IIS, and use Content-Based Routing and/or URL Rewriting to route the requests to them.

查看更多
闹够了就滚
3楼-- · 2019-03-28 19:28

This article may help you. It is about sending large files in .NET. Check the link:

http://codetechnic.blogspot.com/2009/02/sending-large-files-over-tcpip.html

查看更多
手持菜刀,她持情操
4楼-- · 2019-03-28 19:29

You can use sockets in .NET to transfer files and data.

查看更多
唯我独甜
5楼-- · 2019-03-28 19:32

You might want to consider WCF streaming.

查看更多
登录 后发表回答