Q: How to UDPServer ??
drjohn at 21cn.edu.cn
Thu Jan 2 08:03:07 CET 2003
"Peter Hansen" <peter at engcorp.com> Ð´ÈëÏûÏ¢ÐÂÎÅ
:3E136F3A.5DA5E216 at engcorp.com...
> "Å£·à" wrote:
> > I have some problems in the quote_srv.py I write as below, quote server
> > 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.)
You are right! serve_forever() can work!
But, how can I run both servers in a .py file?
More information about the Python-list