result = s.recv(8192)
num_bytes_recv += len(result)
index = result.find('\r\n\r\n')
result_wo_header = result[index+4:]
data = ""
with open(file_name, 'wb') as f:
data+=result_wo_header
while True:
print "number of byte recieve : ",num_bytes_recv
result = s.recv(8192)
print result
if not result:
break
num_bytes_recv+=len(result)
data+=result
f.write(data)
print "download complete"
s.close()
Im trying to download any kinds of file from a given url, the code work perfectly until it reach the end or the last chunk of data, it stuck there up to 10 second. Am I doing anything wrong here? up to 5~10 second from last "number of byte recieve : " to "download complete" please help!!