core.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:agentzero 作者: gabrielfalcao 项目源码 文件源码
def set_socket_option(self, name, option, value):
        """calls ``zmq.setsockopt`` on the given socket.

        :param name: the name of the socket where data will pad through
        :param option: the option from the ``zmq`` module
        :param value:

        Here are some examples of options:

        * ``zmq.HWM``: Set high water mark
        * ``zmq.AFFINITY``: Set I/O thread affinity
        * ``zmq.IDENTITY``: Set socket identity
        * ``zmq.SUBSCRIBE``: Establish message filter
        * ``zmq.UNSUBSCRIBE``: Remove message filter
        * ``zmq.SNDBUF``: Set kernel transmit buffer size
        * ``zmq.RCVBUF``: Set kernel receive buffer size
        * ``zmq.LINGER``: Set linger period for socket shutdown
        * ``zmq.BACKLOG``: Set maximum length of the queue of outstanding connections
        * for the full list go to ``http://api.zeromq.org/4-0:zmq-setsockopt``

        **Example:**

        ::

          >>> import zmq
          >>> from agentzero.core import SocketManager
          >>>
          >>> sockets = SocketManager()
          >>> sockets.create('pipe-in', zmq.PULL)
          >>>
          >>> # block after 10 messages are queued
          >>> sockets.set_socket_option('pipe-in', zmq.HWM, 10)
        """

        socket = self.get_by_name(name)
        socket.setsockopt(option, value)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号