def get_ctx_and_connect_req_socket(zmq_url):
"""Creates a ZMQ context and a REQ socket.
:param zmq_url: URL for the socket to connect to.
:returns: A tuple containing the ZMQ context and the socket.
"""
ctx = zmq.asyncio.Context()
# noinspection PyUnresolvedReferences
socket = ctx.socket(zmq.REQ)
log.debug('Connection to: {}'.format(zmq_url))
socket.connect(zmq_url)
return ctx, socket
评论列表
文章目录