recv

Oleg Seifert misterxx at uni-koblenz.de
Wed Jun 18 04:39:19 EDT 2003


Hi folks,

I have a little question:

I'm supposed to send a network request using Python and print a 
response. I've written the following script for this:
-------------------------------------
from socket import *

def read():
     print s.recv(1024)

s = socket(AF_INET, SOCK_STREAM)
s.connect(("localhost", 99))

s.send("loadGraph(\"g.g\");\n")
read()
s.close()
-------------------------------------
The request is sent and the response arrives as well, but from the 
response I only ever see one line. The responses are different as well, 
they can have different number of lines. How can I print the whole 
response, independent of the structure (numer of lines) of the response?

Thanks.

Oleg





More information about the Python-list mailing list