我想使用 UDP 协议(protocol)将文件从一台计算机发送到另一台计算机。我该怎么做?
我想要一个 sample 来发送文件...
最佳答案
您可以使用 UdpClient .
UDP 不保证传送 - 如果您必须拆分文件,这尤其成问题。请参阅此处进行讨论 - How to send large data using C# UdpClient?
如果这是点对点的(如问题所暗示的),使用 TransmitFile 编写一些 native 代码来执行此操作会很简单。 .
The TransmitFile function transmits file data over a connected socket handle. This function uses the operating system's cache manager to retrieve the file data, and provides high-performance file data transfer over sockets.
关于c# - 使用 UDP 协议(protocol)将 C Sharp 中的文件从计算机发送到另一台计算机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4109313/