Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > SocketServer.BaseRequestHandler has the data, and now?

Reply
Thread Tools

SocketServer.BaseRequestHandler has the data, and now?

 
 
ao11
Guest
Posts: n/a
 
      03-19-2011
Hello,

I wrote a test application to play around with UDP, the receiving part
looks like:

class proxyServer(SocketServer.ThreadingMixIn,
SocketServer.UDPServer):
pass

class proxyHandler(SocketServer.BaseRequestHandler):

def handle(self):
data = self.request[0]
source = self.request[1]
cur_thread = threading.currentThread()
response = "%s - %s: %s" % (cur_thread.getName(), source,
data)
print response

class proxy(process) :

def __init__(self, id, context) :
process.__init__(self, id, context, self.run())
self.server = proxyServer(("", 58889), proxyHandler)
self.thread =
threading.Thread(target=self.server.serve_forever)
self.thread.setDaemon(True)

def __del__(self) :
if self.server != None :
self.server.shutdown()

def run(self) :
self.context.model.register(self)
self.thread.start()
...
...
...

def notify(self) :
print "notify " + str(self.id)

So far so good, but how do I get the data back from the handle method
to somewhere else? In my case I yust would like to add every incoming
datagram to a queue and process it later in a different thread.

How do I hand over the queue to the class
proxyHandler(SocketServer.BaseRequestHandler)?

thanks,

AO
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The company has completely abandoned Windows XP, and it has absolutely no plans to ever ship an XP SP3 Ken Yates@yahooken.com NZ Computing 1 04-07-2007 12:37 AM
Some shareware has a time limit and the software will not work after the time limit has expired. anthony crowder Computer Support 20 01-16-2007 10:01 AM
The printing has been stopped and this job has been add to the queu? dejola Computer Support 6 12-30-2005 03:26 AM
Downloaded document has disappeared by the time Word has opened Rob Nicholson ASP .Net 12 12-06-2005 04:59 PM
ZoneAlarm has detected a problem with your installation, and therefore has restricted Internet access from your machine for your protection. Don’t panic A Teuchter Computer Support 2 05-19-2005 09:20 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57