def verify_socket(host, port):
 def can_connect():
  with closing(socket()) as s:
   s.settimeout(SOCKET_TIMEOUT_FOR_POLLING)
   conn = s.connect_ex((host, port))
   Message.new(message_type='acceptance:verify_socket', host=host, port=port, result=conn).write()
   return (conn == 0)
 dl = loop_until(reactor, can_connect)
 return dl

def verify_socket ( host , port ) : def can_connect ( ) : with closing ( socket ( ) ) as s : s . settimeout ( SOCKET_TIMEOUT_FOR_POLLING ) conn = s . connect_ex ( ( host , port ) ) Message . new ( message_type = 'acceptance:verify_socket' , host = host , port = port , result = conn ) . write ( ) return ( conn == 0 ) dl = loop_until ( reactor , can_connect ) return dl
attempt to bind to the sockets to verify that they are available .