Corrupted binary data
The file sender, when sending the data locally(127.0.0.1, or my IP address), is sent fine and works. However, when I try to send it to another computer, the data is always corrupted. Everything is sent and all, but the application in which it's suppose to open says the data is corrupted. If anyone could give me an idea of why this is happening, that would be great.
You have to convert the data to network byte order before sending it and back to host byte order after recieving it. Look into htons(), htonl(), ntohs(), ntohl(), etc...
> sprintf(charfilesize, "%d", filesize);
Look at where charfilesize is pointing - nowhere.
> int thesend = send(mysocket, buffer, sizeof(buffer), 0);
You're assuming that send() always sends everything on the first call - this isn't true.
Check how much you sent.
Also, what about files which are not a multiple of 1024 in length?
> recv(mysocket, writebuffer, 1024, 0);
Likewise, just because you ask for 1024 doesn't mean you get 1024.
In particular, the last block is almost always going to be less than this.