本文整理汇总了Python中pyczmq._cffi.C类的典型用法代码示例。如果您正苦于以下问题:Python C类的具体用法?Python C怎么用?Python C使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了C类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: apply
def apply(cert, zocket):
"""
Apply certificate to socket, i.e. use for CURVE security on socket.
If certificate was loaded from public file, the secret key will be
undefined, and this certificate will not work successfully.
"""
C.zcert_apply(cert, zocket)
开发者ID:aburan28,项目名称:pyczmq,代码行数:7,代码来源:zcert.py
示例2: send
def send(m, socket):
"""
Send message to socket, destroy after sending. If the message has no
frames, sends nothing but destroys the message anyhow. Safe to call
if zmsg is null.
"""
C.zmsg_send(ptop('zmsg_t', m), socket)
开发者ID:hintjens,项目名称:pyczmq,代码行数:7,代码来源:zmsg.py
示例3: destroy
def destroy(loop):
"""
Destroy a reactor, this is not necessary if you create it with
new.
"""
if loop is not ffi.NULL:
C.zloop_destroy(ptop('zloop_t', loop))
return ffi.NULL
开发者ID:mhaberler,项目名称:pyczmq,代码行数:8,代码来源:zloop.py
示例4: append
def append(m, f):
"""
Add frame to the end of the message, i.e. after all other frames.
Message takes ownership of frame, will destroy it when message is sent.
Returns 0 on success. Deprecates zmsg_add, which did not nullify the
caller's frame reference.
"""
C.zmsg_append(m, ptop('zframe_t', f))
开发者ID:hintjens,项目名称:pyczmq,代码行数:8,代码来源:zmsg.py
示例5: destroy
def destroy(ctx, socket):
"""Destroy a socket within our CZMQ context.
'pyczmq.zsocket.new' automatically registers this destructor with
the garbage collector, so this is normally not necessary to use,
unless you need to destroy sockets created by some other means
(like a call directly to 'pyczmq.C.zsocket_new')
"""
C.zsocket_destroy(ctx, socket)
开发者ID:mhaberler,项目名称:pyczmq,代码行数:9,代码来源:zsocket.py
示例6: zsys_version
def zsys_version():
"""
Returns the tuple (major, minor, patch) of the current czmq version.
"""
major = ffi.new('int*')
minor= ffi.new('int*')
patch = ffi.new('int*')
C.zsys_version(major, minor, patch)
return (major[0], minor[0], patch[0])
开发者ID:aburan28,项目名称:pyczmq,代码行数:9,代码来源:zsys.py
示例7: insert
def insert(store, cert):
"""
Insert certificate into certificate store in memory. Note that this
does not save the certificate to disk. To do that, use zcert_save()
directly on the certificate. Takes ownership of zcert_t object.
"""
return C.zcertstore_insert(store, ptop('zcert_t', cert))
开发者ID:hintjens,项目名称:pyczmq,代码行数:7,代码来源:zcertstore.py
示例8: sendx
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)
开发者ID:aburan28,项目名称:pyczmq,代码行数:7,代码来源:zstr.py
示例9: new_empty
def new_empty():
"""Create an empty (zero-sized) frame.
Note, no gc wrapper, frames self-destruct by send. If you don't
send a frame, you DO have to destroy() it.
"""
return C.zframe_new_empty()
开发者ID:jasco,项目名称:pyczmq,代码行数:7,代码来源:zframe.py
示例10: new
def new(data):
"""Create a new frame with optional size, and optional data
Note, no gc wrapper, frames self-destruct by send. If you don't
send a frame, you DO have to destroy() it.
"""
return C.zframe_new(data, len(data))
开发者ID:jasco,项目名称:pyczmq,代码行数:7,代码来源:zframe.py
示例11: signal
def signal(sock, status):
"""Send a signal over a socket. A signal is a short message carrying a
success/failure code (by convention, 0 means OK). Signals are encoded
to be distinguishable from "normal" messages. Accepts a zock_t or a
zactor_t argument, and returns 0 if successful, -1 if the signal could
not be sent."""
return C.zsock_signal(sock, status)
开发者ID:cyrilleverrier,项目名称:pyczmq,代码行数:7,代码来源:zsock.py
示例12: load
def load(msg, filename):
"""
Load/append an open file into message, create new message if
null message provided. Returns NULL if the message could not
be loaded.
"""
return C.zmsg_load(msg, filename)
开发者ID:fantix,项目名称:pyczmq,代码行数:7,代码来源:zmsg.py
示例13: poller_end
def poller_end(loop, item):
"""
Cancel a pollitem from the reactor, specified by socket or FD. If both
are specified, uses only socket. If multiple poll items exist for same
socket/FD, cancels ALL of them.
"""
return C.zloop_poller_end(loop, item)
开发者ID:hintjens,项目名称:pyczmq,代码行数:7,代码来源:zloop.py
示例14: recv
def recv(socket):
"""
Receive message from socket, returns zmsg_t object or NULL if the recv
was interrupted. Does a blocking recv, if you want to not block then use
the zloop class or zmq_poll to check for socket input before receiving.
"""
return C.zmsg_recv(socket)
开发者ID:fantix,项目名称:pyczmq,代码行数:7,代码来源:zmsg.py
示例15: push
def push(msg, frame):
"""
Push frame to the front of the message, i.e. before all other frames.
Message takes ownership of frame, will destroy it when message is sent.
Returns 0 on success, -1 on error.
"""
return C.zmsg_push(msg, frame)
开发者ID:fantix,项目名称:pyczmq,代码行数:7,代码来源:zmsg.py
示例16: set_rcvhwm
def set_rcvhwm(ctx, rcvhwm):
"""
Set initial receive HWM for all new normal sockets created in context.
You can set this per-socket after the socket is created.
The default, no matter the underlying ZeroMQ version, is 1,000.
"""
return C.zctx_set_rcvhwm(ctx, rcvhwm)
开发者ID:hintjens,项目名称:pyczmq,代码行数:7,代码来源:zctx.py
示例17: recv
def recv(sock):
"""
Receive frame from socket, returns zframe_t object or NULL if the recv
was interrupted. Does a blocking recv, if you want to not block then use
zframe_recv_nowait().
"""
return C.zframe_recv(sock)
开发者ID:hintjens,项目名称:pyczmq,代码行数:7,代码来源:zframe.py
示例18: new
def new(type, filename=None, line_nbr=None):
if filename is None:
frame = inspect.stack()[1][0]
info = inspect.getframeinfo(frame)
filename = info.filename
line_nbr = info.lineno
return ffi.gc(C.zsock_new(type, filename, line_nbr), destroy)
开发者ID:cyrilleverrier,项目名称:pyczmq,代码行数:7,代码来源:zsock.py
示例19: new
def new():
"""Create a new empty message object,
Note, no gc wrapper, messages self-destruct by send. If you don't
send a message, you DO have to destroy() it.
"""
return C.zmsg_new()
开发者ID:fantix,项目名称:pyczmq,代码行数:7,代码来源:zmsg.py
示例20: save
def save(cert, filename):
"""
Save full certificate (public + secret) to file for persistent
storage This creates one public file and one secret file (filename
+ "_secret"). The filename is treated as a printf format
specifier.
"""
return C.zcert_save(cert, filename)
开发者ID:aburan28,项目名称:pyczmq,代码行数:8,代码来源:zcert.py
注:本文中的pyczmq._cffi.C类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论