Whenever I go to transfer a file from my server to my client, I get a new file, but the data does not go through. It prints server side once it is open, but it won't transfer the data to my new file. Here is the code:https://gist.github.com/anonymous/8f70b3e2eca8606dee2c245ce64e9b63

All I want to do is show the files, tell which file the client wants, then it should fetch it. What am I doing wrong?

The main issue IMHO is that you open the file in mode "wb+" instead of "rb" on the server side. You may have erased some files with this.

Also note that serving files through your own socket server is not the most robust solution. You could use turnkey solutions such as ssh, sftp, https etc servers.