Python 2.0.1 bug?
Skip Montanaro
skip at pobox.com
Fri Jul 20 11:24:39 EDT 2001
import socket
HOST = '' # empty string meaning localhost
PORT = 8080
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
while 1:
conn, addr = s.accept()
print 'Connected by', addr
data = conn.recv(1024)
print data
conn.send(data) # reference point 1
conn.close()
Does it help to add
conn.send("HTTP/1.1 200 OK\r\n")
conn.send("Content-Type: text/plain\r\n\r\n")
before you echo the request back to the client? I realize that shouldn't
explain your 1.5.2/2.0.1 differences.
--
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/
More information about the Python-list
mailing list