Reply 20 of 26, by mbbrutman
Another request - can you send me a trace of FTP4DOS transferring the same file? Are you on a real machine or a virtual machine? Do you have any power saving TSRs loaded?
I know my code is calling the DOS Idle interrupt and the interrupt to signal the program is idle when it's just spinning waiting for packets. (Int 2F, AX=1680x). If FTP4DOS is not doing that it might explain the difference.
In general, they both poll to see if new packets have arrived, and then they try to write whatever they have to keep the TCP window open and available. My code updates the file transfer progress on the screen using BIOS calls, and that might be slowing it down, but probably not by such a huge factor.
FTP4DOS spins in a loop, reading from the TCP buffer and writing whatever it finds until the TCP buffer is empty. It will write up to 4KB at a time. My code is slightly different in that it does multiple reads from the socket until it fills the file buffer, and then it does the write. While that should improve performance by making for larger write sizes, it might also prevent the code from polling for the next packet for a few more milliseconds. That kind of subtle difference matters a lot on a faster machine.