Q: How to UDPServer ??

Ripper John drjohn at 21cn.edu.cn
Thu Jan 2 08:10:58 CET 2003


haha, just write like this:

     UDPQuoteSrv.serve_forever()
     TCPQuoteSrv.server_activate()

server_activate() means listen() call, I found it in SocketServer.py

anyway, thanks!

"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
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