receiving data over a python socket -


i'm making program retrieves decently large amounts of data through python socket , disconnects when information finished sending. i'm not sure how this

all examples on web of tcp clients have

while 1:    data = sock.recv(1024) 

but creates infinite loop receive data via socket, not?

i need figure out size of message coming in , loop through in buffer-sized increments full message. , after message has finished sending, disconnect, although think connection closed other end. nice

thanks

you've missed important part of examples - lines follow "recv()" call:

while 1:     data = conn.recv(1024)     if not data: break     conn.send(data) conn.close() 

Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -