Q: How to UDPServer ??
drjohn at 21cn.edu.cn
Thu Jan 2 08:10:58 CET 2003
haha, just write like this:
server_activate() means listen() call, I found it in SocketServer.py
"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.)
More information about the Python-list