示例#1
0
def main(args):
    context = zmq.Context()
    socket = context.socket(zmq.REQ)
    data = ba.parse_address(args.address)
    socket.connect('tcp://%s:%s' % (ba.get_host_ip(data.get('domain')),
                                    args.port))
    socket.send(ba.dumps(data))
    response = socket.recv()
    print response
示例#2
0
def main(args):
    context = zmq.Context()
    socket = context.socket(zmq.REQ)
    data = ba.parse_address(args.address)
    socket.connect('tcp://%s:%s' %
                   (ba.get_host_ip(data.get('domain')), args.port))
    socket.send(ba.dumps(data))
    response = socket.recv()
    print response
示例#3
0
def start_server(host, port, addresses):
    """
    Starts the bitcoinaddress server.
    """
    context = zmq.Context()
    socket = context.socket(zmq.REP)
    address = 'tcp://%s:%s' % (host, port)
    socket.bind(address)
    print 'runs on %s' % address

    while True:
        data = socket.recv()
        data = json.loads(data)
        socket.send(
            ba.dumps({'address': addresses.get(data.get('name'), None)}))