def _connect_socket(host, port):
 start = time.time()
 while True:
  try:
   return _try_connect(host, port)
  except sc_exceptions.SocketConnectionRefused:
   if ((time.time() - start) > constants.SOCKET_CONNECT_TIMEOUT):
    raise sc_exceptions.ConnectionTimeoutException(host=host, port=port)

def _connect_socket ( host , port ) : start = time . time ( ) while True : try : return _try_connect ( host , port ) except sc_exceptions . SocketConnectionRefused : if ( ( time . time ( ) - start ) > constants . SOCKET_CONNECT_TIMEOUT ) : raise sc_exceptions . ConnectionTimeoutException ( host = host , port = port )
try to initiate a connection to a host using an ip address and a port .