[PythonCE] Server socket + MessageBox hangs ?

Telion telionce@yahoo.com
Wed, 27 Nov 2002 08:54:43 -0800 (PST)


--- Olivier Fambon <Olivier.Fambon@xrce.xerox.com> wrote:
> 
> 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

          text = "test text"
          title = "test title"

>         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()
>  

By adding above two lines, this script worked fine
on my machine. (PythonCE2.2+ on HPC2000)

I connected with Teraterm telnet software, disconnected,
and reconnected without problem.

Maybe you should check if you are not trying to run
2nd copy of Python while the server is still active
(but not visible due to the PPC interface).



=====
Telion
- telionce@yahoo.com -
http://pages.ccapcable.com/lac/PythonCE.html

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com