[PythonCE] Server socket + MessageBox hangs ?

Olivier Fambon Olivier.Fambon@xrce.xerox.com
Fri, 22 Nov 2002 15:32:37 +0100


Hi there,

I try to telnet into a Python server on my iPaq (CE3.0). [see server
script bellow]

First connection is ok, the pop-up appears.

Is it just me, or does this hang on the second connection ?

I have to reboot to get the Compaq-quick-button functionnal.

Commenting-out the MessageBox line behaves as expected.

Any hint ?

# Echo server program
import socket, win32gui

def doServer(host='', port=2000):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.bind((host, port))
    s.listen(1)
    while 1:
        print 'waiting for connection on ', port
        conn, addr = s.accept()
        print 'Connected by', addr
        win32gui.MessageBox(0, text, title, 1)

        while 1:
            data = conn.recv(1024)
            if not data:
                conn.close()
                break
            conn.send(data)
        del conn, addr
    print 'Exiting'

if __name__ == '__main__':
    doServer()