How can I fix this?
Well with this great amount of information you gave us on the code you run... Either your server crashed or you closed the socket without a proper shutdown. Either way, your server killed the connection.
I downloaded the .zip file from the first post.
There is a server and a client, with the option to send messages or files.
I haven't modified the original code.
The error occurs after successfully sending a file from the server to the client once.
After that, you can no longer successfully send files.