Helper method for creating a connection to an ``address``.
498619
async def create_connection(self, address=None, protocol_factory=None,
                                **kwargs):
        
        loop = self._loop
        protocol_factory = protocol_factory or self.create_protocol
        if isinstance(address, tuple):
            kwargs['host'] = address[0]
            kwargs['port'] = address[1]
        _, protocol = await loop.create_connection(protocol_factory, **kwargs)
        event = protocol.event('connection_made')
        if not event.fired():
            await event.waiter()
        return protocol
1303572
async def _connect(self, host_loc):
        '''
        
        '''
        scheme, host, path, parameters, query, fragment = urlparse(
            host_loc)
        if parameters or query or fragment:
            raise ValueError('Supplied info beyond scheme, host.' +
                             ' Host should be top level only: ', path)

        host, port = get_netloc_port(scheme, host)

        if scheme == 'http':
            return await self._open_connection_http(
                (host, int(port))), port
        else:
            return await self._open_connection_https(
                (host, int(port))), port
51481
def to(self) -> Optional[Sequence[AddressHeader]]:
        """"""
        try:
            return cast(Sequence[AddressHeader], self[b'to'])
        except KeyError:
            return None
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
1120327
def generate_address(hypervisor, configuration):
    """"""
    ipv4 = configuration['ipv4']
    prefix = configuration['prefix']
    subnet_prefix = configuration['subnet_prefix']
    subnet_address = ipaddress.IPv4Network(u'/'.join((str(ipv4), str(prefix))))
    net_address_pool = subnet_address.subnets(new_prefix=subnet_prefix)

    return address_lookup(hypervisor, net_address_pool)
1013825
def mark_address(self, addr, size):
        """"""
        i = 0
        while i < size:
            self._register_map[addr] = True
            i += 1
136190
def connect(self, address):
        """"""
        if self.uses_nanoconfig:
            raise ValueError("Nanoconfig address must be sole endpoint")
        endpoint_id = _nn_check_positive_rtn(
            wrapper.nn_connect(self.fd, address)
        )
        ep = Socket.ConnectEndpoint(self, endpoint_id, address)
        self._endpoints.append(ep)
        return ep
601303
def create_connection(self):
        """"""
        err = None
        try:
            for res in socket.getaddrinfo(self._server, self._port, 0, self._sock_type):
                af, socktype, proto, canonname, sa = res
                sock = None
                try:
                    sock = socket.socket(af, socktype, proto)
                    sock.settimeout(self._timeout)
                    sock.connect(sa)
                    # Break explicitly a reference cycle
                    err = None
                    return sock

                except socket.error as _:
                    err = _
                    if sock is not None:
                        sock.close()

            if err is not None:
                raise err
            else:
                raise socket.error('No valid addresses found, try checking your IPv6 connectivity')
        except socket.gaierror as e:
            err_code, message = e.args
            if err_code == socket.EAI_NODATA or err_code == socket.EAI_NONAME:
                raise socket.error('Unable to resolve host, check your DNS: {}'.format(message))

            raise
1247377
def _send_to_address(self, address, data, timeout=10):
        
        # Socket to talk to server
        socket = get_context().socket(REQ)
        try:
            socket.setsockopt(LINGER, timeout * 1000)
            if address.find(":") == -1:
                socket.connect("tcp://%s:%d" % (address, self.default_port))
            else:
                socket.connect("tcp://%s" % address)
            socket.send_string(data)
            message = socket.recv_string()
            if message != "ok":
                LOGGER.warn("invalid acknowledge received: %s" % message)

        finally:
            socket.close()
920477
def _connect(self, address):
        

        latency = 0
        conn_interval_min = 6
        conn_interval_max = 100
        timeout = 1.0

        try:
            #Allow passing either a binary address or a hex string
            if isinstance(address, str) and len(address) > 6:
                address = address.replace(':', '')
                address = bytes(bytearray.fromhex(address)[::-1])
        except ValueError:
            return False, None

        #Allow simple determination of whether a device has a public or private address
        #This is not foolproof
        private_bits = bytearray(address)[-1] >> 6
        if private_bits == 0b11:
            address_type = 1
        else:
            address_type = 0

        payload = struct.pack("<6sBHHHH", address, address_type, conn_interval_min,
                              conn_interval_max, int(timeout*100.0), latency)
        response = self._send_command(6, 3, payload)

        result, handle = unpack("<HB", response.payload)
        if result != 0:
            return False, None

        #Now wait for the connection event that says we connected or kill the attempt after timeout
        def conn_succeeded(event):
            if event.command_class == 3 and event.command == 0:
                event_handle, = unpack("B", event.payload[0:1])
                return event_handle == handle

        #FIXME Hardcoded timeout
        events = self._wait_process_events(4.0, lambda x: False, conn_succeeded)
        if len(events) != 1:
            self._stop_scan()
            return False, None

        handle, _, addr, _, interval, timeout, latency, _ = unpack("<BB6sBHHHB", events[0].payload)
        formatted_addr = ":".join(["%02X" % x for x in bytearray(addr)])
        self._logger.info('Connected to device %s with interval=%d, timeout=%d, latency=%d',
                          formatted_addr, interval, timeout, latency)

        connection = {"handle": handle}
        return True, connection
1086199
public static Address from(String address) {
    int lastColon = address.lastIndexOf(':');
    int openBracket = address.indexOf('[');
    int closeBracket = address.indexOf(']');

    String host;
    if (openBracket != -1 && closeBracket != -1) {
      host = address.substring(openBracket + 1, closeBracket);
    } else if (lastColon != -1) {
      host = address.substring(0, lastColon);
    } else {
      host = address;
    }

    int port;
    if (lastColon != -1) {
      try {
        port = Integer.parseInt(address.substring(lastColon + 1));
      } catch (NumberFormatException e) {
        throw new MalformedAddressException(address, e);
      }
    } else {
      port = DEFAULT_PORT;
    }
    return new Address(host, port);
  }
1128110
def getaddress(self, address: str) -> dict:
        ''''''

        return cast(dict, self.ext_fetch('getaddress/' + address))
608820
async function connect(address) {
	const running = await isRunning(address)
	if (!running) {
		throw errCouldNotConnect
	}
	return siadWrapper(address)
}
1199050
def connect(url, prefix=None, **kwargs):
    
    return connection(url, prefix=get_prefix(prefix), **kwargs)
1364469
public CompletableFuture<Connection> getConnection(Address address) {
    Connection connection = connections.get(address);
    return connection == null ? createConnection(address) : CompletableFuture.completedFuture(connection);
  }
973766
public static TcpClientTransport create(InetSocketAddress address) {
    Objects.requireNonNull(address, "address must not be null");

    TcpClient tcpClient = TcpClient.create().addressSupplier(() -> address);
    return create(tcpClient);
  }
1325170
function createChannel(addr) {
  return amqp.connect(genAddr(addr)).then(conn => {
    return conn.createChannel().then(ch => {
      connections.push(conn);

      return [conn, ch];
    });
  }, debugError);
}