Quote:
Originally Posted by MikeJS
I've tried using sockets but sometimes it doesn't strip the header from the file and sometimes adds characters to the end. ( http://pastebin.com/d2e33dfd9 - from line 136)
|
The header should be included only in the first packet.
On lines 158-159, pos will never be -1.
Code:
new pos = StrContains(receiveData, "\r\n\r\n")+4;
if(pos!=-1) {
Also, whats up with lines 161-163?
Code:
WriteFile(file, receiveData[pos], (dataSize-pos)/4, 4);
for(new i=((dataSize-pos)/4)*4;i<dataSize;i++)
WriteFile(file, receiveData[i], 1, 1);
//I'd just do
for(new i=pos;i<dataSize;i++)
WriteFile(file, receiveData[i], 1, 1);
__________________