def __init__(self, host=None, req_port=None, use_security=False):
if host is None:
host = env.get_master_host()
context = zmq.Context()
self._socket = context.socket(zmq.REQ)
self._auth = None
if use_security:
self._auth = Authenticator.instance(
env.get_server_public_key_dir())
self._auth.set_client_key(self._socket, env.get_client_secret_key_path(),
env.get_server_public_key_path())
if req_port is None:
req_port = env.get_req_port()
self._socket.connect(
'tcp://{host}:{port}'.format(host=host, port=req_port))
评论列表
文章目录