I created a UDP socket server
self.UDPServer = SocketServer.UDPServer( ( UDP_IP, UDP_PORT ), UDPServerHandler )
self.server_thread = threading.Thread( target = self.UDPServer.serve_forever )
self.server_thread.setDaemon( True )
self.server_thread.start()
And this is my UDP handler
class UDPServerHandler( SocketServer.BaseRequestHandler ):
def handle( self ):
recv = '';
try:
ans = self.request[0]
print "received" + ans
if( ans ):
#recv = self.checkMessage( recv + ans );
print( ans )
except:
pass;
My question is, how can I send the received data to an other thread? For example I have a GUI, and I want to display the received massage in a text box, or work on the received data etc..
A simple approach is to use the Queue module.