简体   繁体   中英

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. 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? I searched Indy articles too, it's working in Server/Client mode too (as far as I found).

在此输入图像描述

UDP can work in broadcast mode, which is what you need. 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.

Do not reinvent the wheel! If you want to see some working source implementing this concept, see 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".

The source code files are available from 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.

Have a look at Indy's TIdTrivialFTP and TIdTrivialFTPServer components. TFTP is a UDP-based file transfer protocol.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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