gpt4 book ai didi

c# - 使用 UDP 协议(protocol)将 C Sharp 中的文件从计算机发送到另一台计算机

转载 作者:太空宇宙 更新时间:2023-11-03 17:59:21 24 4
gpt4 key购买 nike

我想使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com