[Tutor] socket and lost data
le dahut
le.dahut at laposte.net
Fri Jan 27 11:08:41 CET 2006
Hi,
I try to send some data across a network (between 400KB and 10MB) like
this :
def envoyer(conn, mysize):
print mysize,' KB sent'
data = '1'*1024
data_end = data[:-5]+'#####'
data = data*(mysize-1)
begining = time.time()
conn.send(data)
conn.send(data_end)
passed = time.time() - begining
return passed, size
and receive it like this :
def recevoir(conn):
data=''
while 1:
tmpdata = conn.recv(8192)
data += tmpdata
if '#####' in data:
print 'END OF DATA'
break
print len(data)/1024, ' KB received'
return passed, int(data[-15:-5])/1024
But I don't receive as much data that I sent ... does someone know why ?
If I want to send the same data back to the client, do I have to destroy
and recreate the socket ?
More information about the Tutor
mailing list