How to transfer file using IdUDPServer-IdUDPClient

comicboy
comicboy used Ask the Experts™
on
I've once create a file transfer using IdUDPServer and Client by sending 64byte chuck each time to the client to be saved and built the file. But I think this is stupid there gotta be another way which easier to do rather than read 64KB send it to client and seek the position then write those 64KB (which I've done).

Please experts give me the working sample of using IdUDPServer to client send a file maybe using TStream better.

Since UDP is not reliable sometime chunk I send doesn't arrive while the next chunk arrive which cause trouble, can you also point this problem with your sample ? thanks alot you are all great experts
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Hi,

  I don't recommend to use UDP to transfer a file. TCP connection is the best for it. Please download and try my components for Sending/receiving files.

TAtFileTransfer:
http://hackem-up.hypermart.net/delphi/untfiletransfer.zip

TAtUdp:
http://hackem-up.hypermart.net/delphi/untudp.zip

Ps: hackem-up is just a private name and nothing about hack.

Author

Commented:
Well, I'm using IdUDP for whole of my project and it is to late to rework everything to use TCP, anyway can I use both UDP and TCP at once ?

But your filetransfer which indeed uses Stream may usefull for me to look at and revised it to my own needs, so thank you does help me :)

I add up 50 points for my above question, after that I'll accept your comment thanks :)

Commented:
Hi again,

Of course you can use both TCP and UDP in same project. "I add up 50 points for my above question, after that I'll accept your comment thanks :) " Sorry because of my english but i could not understand this part :)

Regards,

Commented:
Hi again,

Of course you can use both TCP and UDP in same project. "I add up 50 points for my above question, after that I'll accept your comment thanks :) " Sorry because of my english but i could not understand this part :)

Regards,

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial