连接行情前置

        :param pAddress:
484252
def ReqConnect(self, pAddress: str):
        
        self.q.CreateApi()
        spi = self.q.CreateSpi()
        self.q.RegisterSpi(spi)

        self.q.OnFrontConnected = self._OnFrontConnected
        self.q.OnFrontDisconnected = self._OnFrontDisConnected
        self.q.OnRspUserLogin = self._OnRspUserLogin
        self.q.OnRtnDepthMarketData = self._OnRtnDepthMarketData
        self.q.OnRspSubMarketData = self._OnRspSubMarketData

        self.q.RegCB()

        self.q.RegisterFront(pAddress)
        self.q.Init()
38823
def next_addr(addr, i):
    """"""
    str_addr = pad_zeroes(str(int_addr(addr) + i), len(addr[1:]))
    return addr[0] + str_addr
77869
private void pad4() {
        int padSize = currentPos % 4;
        for (int i = 0; i < padSize; i++) {
            output[currentPos++] = 0;
            realSize++;
        }
    }
518957
private static boolean isPortOpen(InetAddress pAddress, int pPort) {
        Socket socket = null;
        try {
            socket = new Socket();
            socket.setReuseAddress(true);
            SocketAddress sa = new InetSocketAddress(pAddress, pPort);
            socket.connect(sa, 200);
            return socket.isConnected();
        } catch (IOException e) {
            return false;
        } finally {
            if (socket != null) {
                try {
                    socket.close();
                } catch (IOException e) {
                    // Best effort. Hate that close throws an IOException, btw. Never saw a real use case for that.
                }
            }
        }
    }
65579
def _ipaddress_match(ipname, host_ip):
    
    # OpenSSL may add a trailing newline to a subjectAltName's IP address
    ip = ip_address(_unicode(ipname).rstrip())
    return ip == host_ip
705529
protected boolean ipInRange(String ipAddress, String range) {
        IpAddressMatcher addressMatcher = new IpAddressMatcher(range);
        return addressMatcher.matches(ipAddress);
    }
894757
public static function str_pad($str, int $pad_length, $pad_string=' ', int $pad_type=\STR_PAD_RIGHT) {
		ref\mb::str_pad($str, $pad_length, $pad_string, $pad_type);
		return $str;
	}
1199747
def next_address_avoid_collision(self, start_addr):
        """"""
        i = 1
        while self.is_address_in_use(next_addr(start_addr, i)):
            i += 1
        return next_addr(start_addr, i)
365262
def out_filter_get(self, address):
        

        func_name = 'neighbor.out_filter.get'
        param = {
            neighbors.IP_ADDRESS: address,
        }

        return call(func_name, **param)
1775
async def main():
    """"""
    async with aiohttp.ClientSession() as session:
        data = Hole('192.168.0.215', loop, session)
        await data.get_data()

        # Get the raw data
        print(json.dumps(data.data, indent=4, sort_keys=True))

        print("Status:", data.status)
        print("Domains being blocked:", data.domains_being_blocked)
281671
def pad(segment, size):
    
    for i in range(size - len(segment)):
        segment.append(0)

    assert len(segment) == size
422232
async def SetMachineAddresses(self, machine_addresses):
        '''
        
        '''
        # map input types to rpc msg
        _params = dict()
        msg = dict(type='Machiner',
                   request='SetMachineAddresses',
                   version=1,
                   params=_params)
        _params['machine-addresses'] = machine_addresses
        reply = await self.rpc(msg)
        return reply
524459
def get_net_start(ipaddr, netmask):
    '''
    
    '''
    net = ipaddress.ip_network('{0}/{1}'.format(ipaddr, netmask), strict=False)
    return six.text_type(net.network_address)
1014211
def _pad_input(incoming):
    
    incoming_expanded = incoming.replace('{', '{{').replace('}', '}}')
    for key in _BASE_CODES:
        before, after = '{{%s}}' % key, '{%s}' % key
        if before in incoming_expanded:
            incoming_expanded = incoming_expanded.replace(before, after)
    return incoming_expanded
1313604
async function isRunning(address) {
	try {
		await call(address, {
			url: '/gateway',
			timeout: 6e5, // 10 minutes
		})
		return true
	} catch (e) {
		return false
	}
}
1245943
def _ipaddress_match(ipname, host_ip):
    
    # OpenSSL may add a trailing newline to a subjectAltName's IP address
    # Divergence from upstream: ipaddress can't handle byte str
    ip = ipaddress.ip_address(_to_unicode(ipname).rstrip())
    return ip == host_ip
406184
function pad(str, length, char) {
	return new BespokeString(str).pad(length, char).toString()
}