Test web server

Axel Grune NineOfSix at gmx.de
Fri Aug 15 11:33:01 EDT 2003


Hi, I'm writing a test script which should act like a simple webserver 
but it does'nt work. IE works but Mozilla say the document contains no 
data. Does any one no what the problem is?

TIA,
Axel

The script:

#!/usr/bin/python

import socket

DATA = """HTTP/1.0 200 OK
Connection: Keep-Alive
Content-Type: text/html
Content-length: 71
Server: Python

<html><head><title>test</title></head><body>Hello Python!</body></html>
"""

s = socket.socket( socket.AF_INET, socket.SOCK_STREAM)
s.bind( ( '', 5333))
s.listen( 1)

conn, addr = s.accept()

conn.send( DATA)
conn.close()





More information about the Python-list mailing list