Exemplo n.º 1
0
 def run(self):
     self.socket = udpSocket.createUDPSocket()
     print "Created Broadcaster"
     while not self.done:
         while self.sendQ:
             msg = self.sendQ.pop()
             self.socket.sendto(msg, ('<broadcast>', const.PORT))
         time.sleep(0.5)
     print "Finished Broadcaster Thread"
Exemplo n.º 2
0
 def run(self):
     print "Starting Listener thread"
     self.socket = udpSocket.createUDPSocket()
     self.socket.bind(('', const.PORT))
     while not self.done:
         try:
             msg, address = self.socket.recvfrom(const.PACKET_SIZE)
             if msg:
                 self.rq.appendleft(msg) # don't have to check if msg is from me, I never send
         except (socket.timeout):
             pass
     
     print "Finished Listener thread"