How do you stream a whole file directly to another machine? lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Awesome Programmer · 2017-04-25 12:40 I know you can read the file a CHUNK at a time and send it over the network, but what I want to know is if you can just stream the whole file. Like Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i fs:TfileStream;fs := TFileStream.Create('Myfile.txt',fmOpenRead);fs.sendstreamt(aSocket);  something like that. ---------------------------------------------------------------------- Remy Lebeau · 2017-04-25 18:53 Quote from: Awesome Programmer on April 25, 2017, 02:40:33 pmI know you can read the file a CHUNK at a time and send it over the network, but what I want to know is if you can just stream the whole file. That is entirely dependent on the capabilities of the socket library you are using.  If it has an API for sending an entire file/TStream for you, then feel free to use it (it will likely just chunk the data automatically for you).  Otherwise, you have to chunk the data manually, like you are already doing. ---------------------------------------------------------------------- Blestan · 2017-04-25 20:07 on linux you can use senfile() syscall.... on windows you use. buffers or  transmitfile() of winsocks2 or you can implement memory maped io and send the hole memory of the file to the socket... your choice