Example #1
0
 def send_control(self, message):
     socket = context.socket(zmq.REQ)
     socket.connect(self.control_address())
     data = {'Protocol': ('Control', 0),
             'Message': message}
     socket.send(json.dumps(data))
     return socket.recv()
Example #2
0
 def bind_socket(self):
     socket = context.socket(zmq.PULL)
     address, port = parse_url(self.address)
     if '.onion' in address:
         bindAddress = 'tcp://127.0.0.1'
     else:
         bindAddress = 'tcp://%s' % address
     logger.debug("%s:%d" % (bindAddress, port))
     socket.bind("%s:%d" % (bindAddress, port))
     return socket
Example #3
0
 def bind_control(self):
     socket = context.socket(zmq.REP)
     socket.bind(self.control_address())
     return socket