python: socket with makefile
Hi,
I am trying to make a simple proxy server in python and I am just learning how to use makefile and readlines/writelines.
I simple open up a socket and starts to listen to a port. The browser is then configured to use this port as proxy server. The server calls accept() on the socket and I then create a file-object using socket.makefile().
Now, I am trying to read the data using readlines() on the file object but it just hangs there, never completes.
Also I am not really sure how to use this makefile. Is it true that I can create a fileobject and then both read from it and write to it, using readlines() and writelines() respectively (on the same file object)?
|