A helper function to make connection.
775818
def __connect(self):
        """"""
        try:
            logger.debug("Socket connecting to %s:%s", self.host, self.port)
            self.sock.connect((self.host, self.port))
        except socket.error as e:
            logger.exception("socket error %s", e)
            logger.error("Closing socket and recreating a new one.")
            self.sock.close()
            self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            self.sock.connect((self.host, self.port))
1067313
def connect(self, addr=None, userinfo=None):
        """"""
        if _debug: ProxyClientService._debug("connect addr=%r", addr)

        # if the address was provided, use it
        if addr:
            self.address = addr
        else:
            addr = self.address

        # if the user was provided, save it
        if userinfo:
            self.userinfo = userinfo

        # make a connection
        conn = ConnectionState(addr)
        self.multiplexer.connections[addr] = conn
        if _debug: ProxyClientService._debug("    - conn: %r", conn)

        # associate with this service, but it is not connected until the ack comes back
        conn.service = self

        # keep a list of pending BSLPDU objects until the ack comes back
        conn.pendingBSLPDU = []

        # build a service request
        request = ServiceRequest(PROXY_SERVICE_ID)
        request.pduDestination = addr

        # send it
        self.service_request(request)

        # return the connection object
        return conn
897778
def connection_made(self, transport):
        """"""
        self._transport = transport
        self._raw_transport = transport
        if isinstance(transport, asyncio.SubprocessTransport):
            self._transport = transport.get_pipe_transport(0)
1042858
def make_connection(self):
        """"""
        if self._created_connections[self._pattern_idx] >= self.max_connections_per_pattern:
            raise ConnectionError("Too many connections")
        self._created_connections[self._pattern_idx] += 1
        conn = self.connection_class(**self.patterns[self._pattern_idx])
        conn._pattern_idx = self._pattern_idx
        return conn
324087
def _connect(self):
        ""
        sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
        sock.settimeout(self.socket_timeout)
        sock.connect(self.path)
        return sock
106726
function connect() {
    // clear pending timeouts
    clearTimeout(timeoutConnectRef);

    // if client already open, just run
    if (client.isOpen) {
        run();
    }

    // if client closed, open a new connection
    client.connectTCP("127.0.0.1", { port: 8502 })
        .then(setClient)
        .then(function() {
            console.log("Connected"); })
        .catch(function(e) {
            checkError(e);
            console.log(e.message); });
}
626616
def connect(obj, signal, slot, event_type=tango.EventType.CHANGE_EVENT):
    """"""
    return obj._helper.connect(signal, slot, event_type=event_type)
929793
def connection(self):
        """"""
        try:
            con = self.thread.connection
        except AttributeError:
            con = self.steady_connection()
            self.thread.connection = con
        return con
884353
def connect(self):
        """"""
        self._client = self._create_client()
        self._db = getattr(self._client, self._db_name)
        self._generic_dao = GenericDAO(self._client, self._db_name)
8948
def _connect(self):
        """"""
        cls = self._get_manager_class(register_callables=False)
        ins = cls(address=self.addr, authkey=self.authkey)
        ins.connect()
        return ins
673533
def _connect(self):
        """"""
        if sys.version_info[:2] < (2,6):
            self._conn = httplib.HTTPConnection(self._host, self._port)
        else:
            self._conn = httplib.HTTPConnection(self._host, self._port, 
                                                False, defaultTimeout)
1018050
def connect(self):
        """"""
        self.socket = socket.create_connection(self.address, self.timeout)
230864
def _maybe_connect(self, to_pid, callback=None):
    """"""

    callback = stack_context.wrap(callback or (lambda stream: None))

    def streaming_callback(data):
      # we are not guaranteed to get an acknowledgment, but log and discard bytes if we do.
      log.info('Received %d bytes from %s, discarding.' % (len(data), to_pid))
      log.debug('  data: %r' % (data,))

    def on_connect(exit_cb, stream):
      log.info('Connection to %s established' % to_pid)
      with self._connection_callbacks_lock:
        self._connections[to_pid] = stream
      self.__dispatch_on_connect_callbacks(to_pid, stream)
      self.__loop.add_callback(
          stream.read_until_close,
          exit_cb,
          streaming_callback=streaming_callback)

    create = False
    with self._connection_callbacks_lock:
      stream = self._connections.get(to_pid)
      callbacks = self._connection_callbacks.get(to_pid)

      if not stream:
        self._connection_callbacks[to_pid].append(callback)

        if not callbacks:
          create = True

    if stream:
      self.__loop.add_callback(callback, stream)
      return

    if not create:
      return

    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
    if not sock:
      raise self.SocketError('Failed opening socket')

    stream = IOStream(sock, io_loop=self.__loop)
    stream.set_nodelay(True)
    stream.set_close_callback(partial(self.__on_exit, to_pid, b'reached end of stream'))

    connect_callback = partial(on_connect, partial(self.__on_exit, to_pid), stream)

    log.info('Establishing connection to %s' % to_pid)

    stream.connect((to_pid.ip, to_pid.port), callback=connect_callback)

    if stream.closed():
      raise self.SocketError('Failed to initiate stream connection')

    log.info('Maybe connected to %s' % to_pid)
475870
def _make_connect(module, args, kwargs):
    
    # pylint: disable-msg=W0142
    return functools.partial(module.connect, *args, **kwargs)
648935
def connection(self):
        """"""
        if not self._connection:
            logger.debug('Opening connection to: {}'.format(self.dsn))
            self._connection = self.engine.connect()
            logger.debug('Opened connection to: {}'.format(self.dsn))

        # logger.debug("Opening connection to: {}".format(self.dsn))
        return self._connection
1064509
def connect(self, object, callback):
		""""""
		return subscription(self.map.setdefault(object, []), callback)
242891
def connect(self):
    """"""
    if self._connected or self.is_alive():
      raise ConnectionExistsError("Already connected")
    # After starting the thread we wait for it to post us
    # an event signifying that connection is established. This
    # ensures that the caller only resumes when we are fully connected.
    self.start()
    with self._lock:
      self._connect_cond.wait_for(lambda: self._connected)