I'll try that, thanks.
Type: Posts; User: tehuknownjedi
I'll try that, thanks.
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...
I got it to work by modifying the while loop, and using read() instead. Thanks for the replies everyone.
I'm doing it because I don't want to send the entire file in one send, since it's crashed the program before, and would not allow me to see the progress of the send.
Well, thanks anyway.
I checked the return result, and both times it's 1024. It only runs through the while loop twice.
while(fileones.get(buffer, 1024))
{
send(mysocket, buffer, 1024, 0);
ZeroMemory(buffer, 1024); // reset buffer
}
Before asking where I declared mysocket, buffer,...
The problem is not with the other end, the problem is with read(). The buffer without being sent over sockets, still is only like 3 bytes.
When the buffer reaches the other end, I write the buffer to file. And only a small ammount of the original file is sent and written.
thanks, but that stuff isn't the problem. I can succesfully open a text file, and send it. But when trying to open a bin file(like "encrypt.exe"), it only reads a small ammount.
http://rafb.net/paste/results/pCFBDE69.html
that isn't the problem. that mistake was made while posting the code(filesize is declared and value is set before memblock).
filename = "encrypter.exe";
ifstream file(filename, ios::in|ios::binary|ios::ate);
if(file.is_open())
{
char* memblock = new char[filesize];
int filesize = thefile.tellg();...
When using read() to read a binary file's data, it only gets the first byte, like: ÿû’D
Does anyone know how I might be able to fix this?