ZeroMQ 官方地址 :http://api.zeromq.org/4-0:zmq_ctx_set
zmq_ctx_set(3) ØMQ Manual - ØMQ/3.2.5
Name
zmq_ctx_set - 設置環境上下文屬性
Synopsis
int zmq_ctx_set (void *context, int option_name, int option_value);
Description
函數 zmq_ctx_set() 將參數option_name指定的屬性設置為參數option_value 的值。
zmq_ctx_set() 函數可以設置下列的參數:
ZMQ_IO_THREADS:設置I/O線程的個數
ZMQ_IO_THREADS參數用來指定ZMQ 線程池的大小,來對I/O進行操作。
如果你的應用程序只是使用inproc方式進行傳輸,你可以把這個值設置為0,否則你至少要設置成1。這個屬性必須在向這個context上創建socket之前進行設置。
默認值 1
ZMQ_MAX_SOCKETS:設置socket數量的最大值
ZMQ_MAX_SOCKETS參數設置允許在這個context上創建socket數量的最大值。
默認值 1024
Return value
執行成功時,zmq_ctx_set() 函數返回0。否則函數返回 -1,並且設置errno為下列定義的值。
Errors
EINVAL
參數給定的屬性option_name未知。
Example
給socket設置最大值。
1 void *context = zmq_ctx_new (); 2 zmq_ctx_set (context, ZMQ_MAX_SOCKETS, 256); 3 int max_sockets = zmq_ctx_get (context, ZMQ_MAX_SOCKETS); assert (max_sockets == 256);
See also
zmq_ctx_get(3) zmq(7)
Authors
This ØMQ manual page was written by Pieter Hintjens <ph@imatix.com>
Web site design and content is copyright (c) 2007-2012 iMatix Corporation. Contact us for professional support. Site content licensed under the Creative Commons Attribution-Share Alike 3.0 License. ØMQ is copyright (c) Copyright (c) 2007-2012 iMatix Corporation and Contributors. ØMQ is free software licensed under the LGPL. ØMQ, ZeroMQ, and 0MQ are trademarks of iMatix Corporation. Terms of Use — Privacy
Policy
更多 ZeroMQ API :http://www.cnblogs.com/fengbohello/p/4230135.html
風波:風波
fengbohello@qq.com