M
Mohammed Smadi
hi;
If i have a tcp connection with a remote server, what is a good way to
read all the data into a buffer before starting to process the data?
I know that the data recieved will be 3 lines with CRLF between them.
However if I can sock.recv(1024) the output is not consistent all the
time, sometime i get one line and sometimes i get two. So I figures I
should read all the data first then work on it and I used the following
code:
result = []
while True:
got=s.recv(1024)
print got
if not got: break
result.append(got)
got = [] # i tried also taking this out
s.close()
but this code just hangs in the loop and never quits
any ideas will be much appreciated
moe smadi
If i have a tcp connection with a remote server, what is a good way to
read all the data into a buffer before starting to process the data?
I know that the data recieved will be 3 lines with CRLF between them.
However if I can sock.recv(1024) the output is not consistent all the
time, sometime i get one line and sometimes i get two. So I figures I
should read all the data first then work on it and I used the following
code:
result = []
while True:
got=s.recv(1024)
print got
if not got: break
result.append(got)
got = [] # i tried also taking this out
s.close()
but this code just hangs in the loop and never quits
any ideas will be much appreciated
moe smadi