socket.makefile() question

Scott Barron sbarron at twilight.
Tue Dec 14 02:25:20 EST 1999


(I tried to reply by mail but the delivery failed)

Hi,

Are you sure you don't mean:
wf = conn.makefile ('wb')
rf = conn.makefile ('rb')

in service() ?
conn is the new socket returned by accept(), s is the original.
I changed it and got this:

twilight:~$ telnet localhost 5555
Trying 127.0.0.1...
Connected to twilight.
Escape character is '^]'.
generic message

Is this what you're looking for?

-Scott


On Mon, 13 Dec 1999 21:15:59 -0600, Charles Follett <cfollett at gac.edu> wrote:
>It is my understanding from the documentation that socket.makefile()
>takes a socket object and returns a nice file object, with all the
>associated methods. I attempt to use this in the attached code, but to
>no avail; I get an error every time I try and write to it:
>
>Traceback (innermost last):
>  File "/var/tmp/python-root/usr/lib/python1.5/threading.py", line 376, in __bootstrap
>    self.run()
>  File "/var/tmp/python-root/usr/lib/python1.5/threading.py", line 364, in run
>    apply(self.__target, self.__args, self.__kwargs)
>  File "./server.py", line 31, in service
>    wf.flush()
>IOError: [Errno 32] Broken pipe
>
>The client (telnet) never recieves the message. Here is the
>code. Perhaps someone can explain what I am doing wrong.
>
>Thanks..
>charley
>
<snip>



More information about the Python-list mailing list