简体   繁体   English

在Delphi中传输UDP文件

[英]UDP file transferring in Delphi

I am writing a program to transfer files through a lan computers, it's been a while I'm searching for file transferring methods in Delphi. 我正在编写一个程序来通过局域网计算机传输文件,我已经有一段时间在Delphi中搜索文件传输方法了。 I found UDP is a good solution, but there is a problem: in every example or article I found there was a client program beside a server program, but my program have to send and receive to/from every computer in network, there is no specific server or client, something like p2p, I don't want to make a computer Server and another one Client, what should I do? 我发现UDP是一个很好的解决方案,但是有一个问题:在每个示例或文章中我发现服务器程序旁边都有一个客户端程序,但我的程序必须向/从网络中的每台计算机发送和接收,没有特定的服务器或客户端,像p2p,我不想制作计算机服务器和另一个客户端,我该怎么办? I searched Indy articles too, it's working in Server/Client mode too (as far as I found). 我也搜索了Indy文章,它也在服务器/客户端模式下工作(据我所知)。

在此输入图像描述

UDP can work in broadcast mode, which is what you need. UDP可以在广播模式下工作,这是您所需要的。 But such UDP broadcasts are not routable outside the current network (ie they are blocked by routers), so you have to implement something more complex if your project needs to be accessible outside the primary physical network. 但是这样的UDP广播不能在当前网络之外路由 (即它们被路由器阻止),因此如果您的项目需要在主物理网络之外可访问,则必须实现更复杂的东西。

Do not reinvent the wheel! 不要重新发明轮子! If you want to see some working source implementing this concept, see Ares Galaxy : 如果您想看到实现此概念的一些工作源,请参阅Ares Galaxy

"Delphi self-organizing p2p network project featuring high scale capability and fast broadcast-type search system. Client supports multi-source file transfers, partial file sharing, built-in audio/video player and decentralized chat rooms". “具有高规模能力和快速广播式搜索系统的Delphi自组织p2p网络项目。客户端支持多源文件传输,部分文件共享,内置音频/视频播放器和分散式聊天室”。

The source code files are available from SourceForge . 源代码文件可从SourceForge获得 You could re-use/adapt the P2P network layer for your needs - but take attention to the license terms of Ares source code, if you use it in your projects. 您可以根据需要重新使用/调整P2P网络层 - 但是如果您在项目中使用它,请注意Ares源代码的许可条款。

Have a look at Indy's TIdTrivialFTP and TIdTrivialFTPServer components. 看看Indy的TIdTrivialFTPTIdTrivialFTPServer组件。 TFTP is a UDP-based file transfer protocol. TFTP是基于UDP的文件传输协议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM