如何强制File.Move / File.Copy使用特定的网络接口卡(NIC)C#? [英] How to force File.Move / File.Copy to use a specific Network Interface Card (NIC) C#?
问题描述
我有一台机器有多个网卡。我的过程是非常网络消费,因为它复制许多文件在网络上的共享位置不同的机器上(例如\ ...)。
I have a machine with several network cards. My process is very network consuming, as it copies many files over the network to a shared location on a different machine (e.g "\...").
我想设置一个专门的网卡这个过程中,但 File.Copy
C#的IO的API \ File.Move
掩盖所使用的网卡。
I would like to set a dedicated NIC for that process, but the C# IO API of File.Copy
\ File.Move
mask the NIC that is used.
如何在C#中,甚至使用一些C ++中的C#项目下的调整来完成?
How can it be done in C# or even by using some C++ tweak under the C# project?
推荐答案
File.Move()
和 File.Copy()
实际上并不具有网络的任何knowlege。它完全依赖于OS来处理一切。所以,如果你移动/ A文件复制到恰好是一个网络安装路径......那就这样吧。但移动()
和复制()
真的不在乎。
File.Move()
and File.Copy()
don't actually have any knowlege of a network. It relies fully on the OS to handle everything. So if you move/copy a file to a path that happens to be a network mount... then so be it. But Move()
and Copy()
don't really care.
话虽这么说,你可以设置一个协议,通过插槽
,可以绑定到一个NIC。
That being said, you could setup a protocol via Sockets
that can bind to a NIC.
假设你有一个尼加
这是123.1.2.3和 NICB
这是156.2。 3.4。然后,你可以创建一个套接字和绑定()
到 ip地址
符合您所关心的网卡。
Say you have a NicA
that is on "123.1.2.3" and NicB
that is on "156.2.3.4". Then you could create a socket and Bind()
to the IPAddress
that matches the NIC you care about.
这篇关于如何强制File.Move / File.Copy使用特定的网络接口卡(NIC)C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!