示例#1
0
文件: zmq.py 项目: minrk/pyczmq
def version():
    """Returns the tuple (major, minor, patch) of the current zmq
    version.
    """
    major = ffi.new('int*')
    minor = ffi.new('int*')
    patch = ffi.new('int*')
    Z.zmq_version(major, minor, patch)
    return (major[0], minor[0], patch[0])
示例#2
0
文件: zmq.py 项目: hintjens/pyczmq
def version():
    """Returns the tuple (major, minor, patch) of the current zmq
    version.
    """
    major = ffi.new('int*')
    minor= ffi.new('int*')
    patch = ffi.new('int*')
    Z.zmq_version(major, minor, patch)
    return (major[0], minor[0], patch[0])
示例#3
0
文件: zstr.py 项目: aburan28/pyczmq
def sendx(sock, *strings):
    """
    Send a series of strings (until NULL) as multipart data
    Returns 0 if the strings could be sent OK, or -1 on error.
    """
    varargs = [ffi.new('char[]', s) for s in strings] + [ffi.NULL]
    return C.zstr_sendx(sock, *varargs)
示例#4
0
def sendx(sock, *strings):
    """
    Send a series of strings (until NULL) as multipart data
    Returns 0 if the strings could be sent OK, or -1 on error.
    """
    varargs = [ffi.new('char[]', s) for s in strings] + [ffi.NULL]
    return C.zstr_sendx(sock, *varargs)
示例#5
0
文件: zmq.py 项目: minrk/pyczmq
def pollitem(socket=None, fd=0, events=0, revents=0):
    """
    Helper to create a pollitem object for zmq.poll/zpoller.poller.

    Must set either socket or fd, if socket is set, fd is ignored.
    """
    return ffi.new('zmq_pollitem_t*',
                   dict(socket=socket, fd=fd, events=events, revents=revents))
示例#6
0
文件: zmq.py 项目: hintjens/pyczmq
def pollitem(socket=None, fd=0, events=0, revents=0):
    """
    Helper to create a pollitem object for zmq.poll/zpoller.poller.

    Must set either socket or fd, if socket is set, fd is ignored.
    """
    return ffi.new('zmq_pollitem_t*', 
                   dict(socket=socket, fd=fd,
                        events=events, revents=revents))