View Single Post
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 05-04-2009 , 18:15   Re: [EXTENSION] Web downloader
Reply With Quote #27

Quote:
Originally Posted by MikeJS View Post
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);
__________________
plop
p3tsin is offline