problem on socket programming

MalC0de malc0de.encrypt at gmail.com
Fri Jul 31 09:25:09 CEST 2009


hello there, I'm using Learning Python 3rd edition as my core
reference, the book is great.
here's some snippet for demonstrating echo-server program, but I can't
interpret it in both windows / Gnu linux ...

#!/usr/bin/env python
from socket import *
myHost = ''
myPort = 50007
sockobj = socket(AF_INET,SOCK_STREAM)
sockobj.bind((myHost,myPort))
sockobj.listen(5)
while true :
    connection,address = sockobj.accept()
    print 'server connected by :',address
    while True:
        data = connection.recv(1024)
        if not data: break
        connection.send('echo : '+ data)
    connection.close()

where's the problem,
beforehand appreciate ...



More information about the Python-list mailing list