Exemple #1
0
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])
Exemple #2
0
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])
Exemple #3
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)
Exemple #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)
Exemple #5
0
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))
Exemple #6
0
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))