def discovery_agent(rpyc_port):
 data = struct.pack('<H', rpyc_port)
 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 s.bind(('', UDP_DISCOVERY_PORT))
 log('discovery_agent: started')
 while True:
  (query, addr) = s.recvfrom(MAX_DGRAM_SIZE)
  if (query == QUERY_MAGIC):
   log('discovery_agent: now answering', addr)
   s.sendto(data, addr)

def discovery_agent ( rpyc_port ) : data = struct . pack ( '<H' , rpyc_port ) s = socket . socket ( socket . AF_INET , socket . SOCK_DGRAM ) s . bind ( ( '' , UDP_DISCOVERY_PORT ) ) log ( 'discovery_agent: started' ) while True : ( query , addr ) = s . recvfrom ( MAX_DGRAM_SIZE ) if ( query == QUERY_MAGIC ) : log ( 'discovery_agent: now answering' , addr ) s . sendto ( data , addr )
answers broadcasted queries with the port of the rpyc server on this machine .