Q: How to UDPServer ??

Peter Hansen peter at engcorp.com
Wed Jan 1 17:44:10 EST 2003


"Å£·à" wrote:
> 
> I have some problems in the quote_srv.py I write as below, quote server on
> TCP works well, but I can get no message on the UDP mode, are there some
> problems in the QutoeMyxinHandler ??

> if __name__=='__main__':
>     UDPQuoteSrv = UDPServer( ('', quote_port), UDPQuoteHandler )
>     TCPQuoteSrv = TCPServer( ('', quote_port), TCPQuoteHandler )
> 
>     UDPQuoteSrv.server_activate()
>     TCPQuoteSrv.serve_forever()

Looks to me like you need to call serve_forever() on the UDPQuoteSrv
as well, but of course you can't do that on both servers from the
same thread and get useful results.  Try changing the last line above
to use the UDPQuoteSrv and see if it works.

(There may be other mistakes, but this one just stood out.  I can't
be sure this is the only problem you have as I haven't tried to run
the code.)

-Peter




More information about the Python-list mailing list