The failed transfers has 1/3 rate is on same computer.
I think that't not too normal.
I can think of only two things why the transfers would fail.
Here, the transfer-rate is about 2 failed on 15 good transfers.
You still have a TTimer in the main thread which accesses FileThread.MainStream.
It's the same way around... a thread may not access unsafe variables from the main thread... but at the same time, the main thread may not access unsafe variables from any other thread. So the access in GetTimerTimer() is a problem.
(You can access FileThread.infile_size etc before the thread is really started. But not FileThread.MainStream, while that stream is used in the thread !!!)
Another potential problem is that you use the Connection variable (Socket) in the thread. This Socket is created in the main thread (and used for string-messages). So using this thread-unsafe variable also in a thread can lead to problems. That's why in the beginning suggested you create a separate file-transfer socket.
For this you could add a parameter to your >StartSendFile for the port the server is listening on.
>StartSendFile,filename.txt,1234,4324243,3246
(where 3246 would be the port the server is listening on for connection of a new socket)
In that case you can also eliminate the two Sleep(2000) and the transfer will start much prompter.
I have one question. This program is only used on an internal network? Or do you need to forward ports later on to make it accessible to the internet???
If it's local you can choose a random free port for filetransfer on the server and pass that on to the client.
In that case, multiple files can be transferred at the same time from multiple clients.
If it's an internet access program, you might want to choose a static port. You now have 3245 for string-socket... you could use 3246 for file transfer. That will limit your potential for multiple transfers at the same time though. But for this case you wouldn't need to pass the port to the client because it's always fixed at 3246.