def discover_servers(subnet='255.255.255.255', timeout=1):
 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
 s.sendto(QUERY_MAGIC, (subnet, UDP_DISCOVERY_PORT))
 replies = []
 while True:
  (rlist, dummy, dummy) = select.select([s], [], [], timeout)
  if (not rlist):
   break
  (data, (addr, port)) = s.recvfrom(MAX_DGRAM_SIZE)
  (rpyc_port,) = struct.unpack('<H', data)
  replies.append((addr, rpyc_port))
 return list(set(replies))

def discover_servers ( subnet = '255.255.255.255' , timeout = 1 ) : s = socket . socket ( socket . AF_INET , socket . SOCK_DGRAM ) s . setsockopt ( socket . SOL_SOCKET , socket . SO_BROADCAST , 1 ) s . sendto ( QUERY_MAGIC , ( subnet , UDP_DISCOVERY_PORT ) ) replies = [ ] while True : ( rlist , dummy , dummy ) = select . select ( [ s ] , [ ] , [ ] , timeout ) if ( not rlist ) : break ( data , ( addr , port ) ) = s . recvfrom ( MAX_DGRAM_SIZE ) ( rpyc_port , ) = struct . unpack ( '<H' , data ) replies . append ( ( addr , rpyc_port ) ) return list ( set ( replies ) )
broadcasts a query and returns a list of of running servers .