PageRenderTime 43ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/doc/zmq_setsockopt.txt

https://github.com/unixcrh/libzmq
Plain Text | 559 lines | 431 code | 128 blank | 0 comment | 0 complexity | 1460797296c3ff360b3b278dd1dac3fc MD5 | raw file
Possible License(s): GPL-3.0, LGPL-3.0
  1. zmq_setsockopt(3)
  2. =================
  3. NAME
  4. ----
  5. zmq_setsockopt - set 0MQ socket options
  6. SYNOPSIS
  7. --------
  8. *int zmq_setsockopt (void '*socket', int 'option_name', const void '*option_value', size_t 'option_len');*
  9. Caution: All options, with the exception of ZMQ_SUBSCRIBE, ZMQ_UNSUBSCRIBE,
  10. ZMQ_LINGER, ZMQ_ROUTER_MANDATORY and ZMQ_XPUB_VERBOSE only take effect for
  11. subsequent socket bind/connects.
  12. DESCRIPTION
  13. -----------
  14. The _zmq_setsockopt()_ function shall set the option specified by the
  15. 'option_name' argument to the value pointed to by the 'option_value' argument
  16. for the 0MQ socket pointed to by the 'socket' argument. The 'option_len'
  17. argument is the size of the option value in bytes.
  18. The following socket options can be set with the _zmq_setsockopt()_ function:
  19. ZMQ_SNDHWM: Set high water mark for outbound messages
  20. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  21. The 'ZMQ_SNDHWM' option shall set the high water mark for outbound messages on
  22. the specified 'socket'. The high water mark is a hard limit on the maximum
  23. number of outstanding messages 0MQ shall queue in memory for any single peer
  24. that the specified 'socket' is communicating with. A value of zero means no
  25. limit.
  26. If this limit has been reached the socket shall enter an exceptional state and
  27. depending on the socket type, 0MQ shall take appropriate action such as
  28. blocking or dropping sent messages. Refer to the individual socket descriptions
  29. in linkzmq:zmq_socket[3] for details on the exact action taken for each socket
  30. type.
  31. NOTE: 0MQ does not guarantee that the socket will accept as many as ZMQ_SNDHWM
  32. messages, and the actual limit may be as much as 60-70% lower depending on the
  33. flow of messages on the socket.
  34. [horizontal]
  35. Option value type:: int
  36. Option value unit:: messages
  37. Default value:: 1000
  38. Applicable socket types:: all
  39. ZMQ_RCVHWM: Set high water mark for inbound messages
  40. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  41. The 'ZMQ_RCVHWM' option shall set the high water mark for inbound messages on
  42. the specified 'socket'. The high water mark is a hard limit on the maximum
  43. number of outstanding messages 0MQ shall queue in memory for any single peer
  44. that the specified 'socket' is communicating with. A value of zero means no
  45. limit.
  46. If this limit has been reached the socket shall enter an exceptional state and
  47. depending on the socket type, 0MQ shall take appropriate action such as
  48. blocking or dropping sent messages. Refer to the individual socket descriptions
  49. in linkzmq:zmq_socket[3] for details on the exact action taken for each socket
  50. type.
  51. [horizontal]
  52. Option value type:: int
  53. Option value unit:: messages
  54. Default value:: 1000
  55. Applicable socket types:: all
  56. ZMQ_AFFINITY: Set I/O thread affinity
  57. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  58. The 'ZMQ_AFFINITY' option shall set the I/O thread affinity for newly created
  59. connections on the specified 'socket'.
  60. Affinity determines which threads from the 0MQ I/O thread pool associated with
  61. the socket's _context_ shall handle newly created connections. A value of zero
  62. specifies no affinity, meaning that work shall be distributed fairly among all
  63. 0MQ I/O threads in the thread pool. For non-zero values, the lowest bit
  64. corresponds to thread 1, second lowest bit to thread 2 and so on. For example,
  65. a value of 3 specifies that subsequent connections on 'socket' shall be handled
  66. exclusively by I/O threads 1 and 2.
  67. See also linkzmq:zmq_init[3] for details on allocating the number of I/O
  68. threads for a specific _context_.
  69. [horizontal]
  70. Option value type:: uint64_t
  71. Option value unit:: N/A (bitmap)
  72. Default value:: 0
  73. Applicable socket types:: N/A
  74. ZMQ_SUBSCRIBE: Establish message filter
  75. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  76. The 'ZMQ_SUBSCRIBE' option shall establish a new message filter on a 'ZMQ_SUB'
  77. socket. Newly created 'ZMQ_SUB' sockets shall filter out all incoming messages,
  78. therefore you should call this option to establish an initial message filter.
  79. An empty 'option_value' of length zero shall subscribe to all incoming
  80. messages. A non-empty 'option_value' shall subscribe to all messages beginning
  81. with the specified prefix. Multiple filters may be attached to a single
  82. 'ZMQ_SUB' socket, in which case a message shall be accepted if it matches at
  83. least one filter.
  84. [horizontal]
  85. Option value type:: binary data
  86. Option value unit:: N/A
  87. Default value:: N/A
  88. Applicable socket types:: ZMQ_SUB
  89. ZMQ_UNSUBSCRIBE: Remove message filter
  90. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  91. The 'ZMQ_UNSUBSCRIBE' option shall remove an existing message filter on a
  92. 'ZMQ_SUB' socket. The filter specified must match an existing filter previously
  93. established with the 'ZMQ_SUBSCRIBE' option. If the socket has several
  94. instances of the same filter attached the 'ZMQ_UNSUBSCRIBE' option shall remove
  95. only one instance, leaving the rest in place and functional.
  96. [horizontal]
  97. Option value type:: binary data
  98. Option value unit:: N/A
  99. Default value:: N/A
  100. Applicable socket types:: ZMQ_SUB
  101. ZMQ_IDENTITY: Set socket identity
  102. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  103. The 'ZMQ_IDENTITY' option shall set the identity of the specified 'socket'.
  104. Socket identity is used only by request/reply pattern. Namely, it can be used
  105. in tandem with ROUTER socket to route messages to the peer with specific
  106. identity.
  107. Identity should be at least one byte and at most 255 bytes long. Identities
  108. starting with binary zero are reserved for use by 0MQ infrastructure.
  109. If two peers use the same identity when connecting to a third peer, the
  110. results shall be undefined.
  111. [horizontal]
  112. Option value type:: binary data
  113. Option value unit:: N/A
  114. Default value:: NULL
  115. Applicable socket types:: all
  116. ZMQ_RATE: Set multicast data rate
  117. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  118. The 'ZMQ_RATE' option shall set the maximum send or receive data rate for
  119. multicast transports such as linkzmq:zmq_pgm[7] using the specified 'socket'.
  120. [horizontal]
  121. Option value type:: int
  122. Option value unit:: kilobits per second
  123. Default value:: 100
  124. Applicable socket types:: all, when using multicast transports
  125. ZMQ_RECOVERY_IVL: Set multicast recovery interval
  126. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  127. The 'ZMQ_RECOVERY_IVL' option shall set the recovery interval for multicast
  128. transports using the specified 'socket'. The recovery interval determines the
  129. maximum time in milliseconds that a receiver can be absent from a multicast
  130. group before unrecoverable data loss will occur.
  131. CAUTION: Exercise care when setting large recovery intervals as the data
  132. needed for recovery will be held in memory. For example, a 1 minute recovery
  133. interval at a data rate of 1Gbps requires a 7GB in-memory buffer.
  134. [horizontal]
  135. Option value type:: int
  136. Option value unit:: milliseconds
  137. Default value:: 10000
  138. Applicable socket types:: all, when using multicast transports
  139. ZMQ_SNDBUF: Set kernel transmit buffer size
  140. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  141. The 'ZMQ_SNDBUF' option shall set the underlying kernel transmit buffer size
  142. for the 'socket' to the specified size in bytes. A value of zero means leave
  143. the OS default unchanged. For details please refer to your operating system
  144. documentation for the 'SO_SNDBUF' socket option.
  145. [horizontal]
  146. Option value type:: int
  147. Option value unit:: bytes
  148. Default value:: 0
  149. Applicable socket types:: all
  150. ZMQ_RCVBUF: Set kernel receive buffer size
  151. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  152. The 'ZMQ_RCVBUF' option shall set the underlying kernel receive buffer size for
  153. the 'socket' to the specified size in bytes. A value of zero means leave the
  154. OS default unchanged. For details refer to your operating system documentation
  155. for the 'SO_RCVBUF' socket option.
  156. [horizontal]
  157. Option value type:: int
  158. Option value unit:: bytes
  159. Default value:: 0
  160. Applicable socket types:: all
  161. ZMQ_LINGER: Set linger period for socket shutdown
  162. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  163. The 'ZMQ_LINGER' option shall set the linger period for the specified 'socket'.
  164. The linger period determines how long pending messages which have yet to be
  165. sent to a peer shall linger in memory after a socket is closed with
  166. linkzmq:zmq_close[3], and further affects the termination of the socket's
  167. context with linkzmq:zmq_term[3]. The following outlines the different
  168. behaviours:
  169. * The default value of '-1' specifies an infinite linger period. Pending
  170. messages shall not be discarded after a call to _zmq_close()_; attempting to
  171. terminate the socket's context with _zmq_term()_ shall block until all
  172. pending messages have been sent to a peer.
  173. * The value of '0' specifies no linger period. Pending messages shall be
  174. discarded immediately when the socket is closed with _zmq_close()_.
  175. * Positive values specify an upper bound for the linger period in milliseconds.
  176. Pending messages shall not be discarded after a call to _zmq_close()_;
  177. attempting to terminate the socket's context with _zmq_term()_ shall block
  178. until either all pending messages have been sent to a peer, or the linger
  179. period expires, after which any pending messages shall be discarded.
  180. [horizontal]
  181. Option value type:: int
  182. Option value unit:: milliseconds
  183. Default value:: -1 (infinite)
  184. Applicable socket types:: all
  185. ZMQ_RECONNECT_IVL: Set reconnection interval
  186. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  187. The 'ZMQ_RECONNECT_IVL' option shall set the initial reconnection interval for
  188. the specified 'socket'. The reconnection interval is the period 0MQ
  189. shall wait between attempts to reconnect disconnected peers when using
  190. connection-oriented transports. The value -1 means no reconnection.
  191. NOTE: The reconnection interval may be randomized by 0MQ to prevent
  192. reconnection storms in topologies with a large number of peers per socket.
  193. [horizontal]
  194. Option value type:: int
  195. Option value unit:: milliseconds
  196. Default value:: 100
  197. Applicable socket types:: all, only for connection-oriented transports
  198. ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval
  199. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  200. The 'ZMQ_RECONNECT_IVL_MAX' option shall set the maximum reconnection interval
  201. for the specified 'socket'. This is the maximum period 0MQ shall wait between
  202. attempts to reconnect. On each reconnect attempt, the previous interval shall be
  203. doubled untill ZMQ_RECONNECT_IVL_MAX is reached. This allows for exponential
  204. backoff strategy. Default value means no exponential backoff is performed and
  205. reconnect interval calculations are only based on ZMQ_RECONNECT_IVL.
  206. NOTE: Values less than ZMQ_RECONNECT_IVL will be ignored.
  207. [horizontal]
  208. Option value type:: int
  209. Option value unit:: milliseconds
  210. Default value:: 0 (only use ZMQ_RECONNECT_IVL)
  211. Applicable socket types:: all, only for connection-oriented transports
  212. ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections
  213. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  214. The 'ZMQ_BACKLOG' option shall set the maximum length of the queue of
  215. outstanding peer connections for the specified 'socket'; this only applies to
  216. connection-oriented transports. For details refer to your operating system
  217. documentation for the 'listen' function.
  218. [horizontal]
  219. Option value type:: int
  220. Option value unit:: connections
  221. Default value:: 100
  222. Applicable socket types:: all, only for connection-oriented transports.
  223. ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size
  224. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225. Limits the size of the inbound message. If a peer sends a message larger than
  226. ZMQ_MAXMSGSIZE it is disconnected. Value of -1 means 'no limit'.
  227. [horizontal]
  228. Option value type:: int64_t
  229. Option value unit:: bytes
  230. Default value:: -1
  231. Applicable socket types:: all
  232. ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets
  233. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  234. Sets the time-to-live field in every multicast packet sent from this socket.
  235. The default is 1 which means that the multicast packets don't leave the local
  236. network.
  237. [horizontal]
  238. Option value type:: int
  239. Option value unit:: network hops
  240. Default value:: 1
  241. Applicable socket types:: all, when using multicast transports
  242. ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN
  243. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  244. Sets the timeout for receive operation on the socket. If the value is `0`,
  245. _zmq_recv(3)_ will return immediately, with a EAGAIN error if there is no
  246. message to receive. If the value is `-1`, it will block until a message is
  247. available. For all other values, it will wait for a message for that amount
  248. of time before returning with an EAGAIN error.
  249. [horizontal]
  250. Option value type:: int
  251. Option value unit:: milliseconds
  252. Default value:: -1 (infinite)
  253. Applicable socket types:: all
  254. ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN
  255. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  256. Sets the timeout for send operation on the socket. If the value is `0`,
  257. _zmq_send(3)_ will return immediately, with a EAGAIN error if the message
  258. cannot be sent. If the value is `-1`, it will block until the message is sent.
  259. For all other values, it will try to send the message for that amount of time
  260. before returning with an EAGAIN error.
  261. [horizontal]
  262. Option value type:: int
  263. Option value unit:: milliseconds
  264. Default value:: -1 (infinite)
  265. Applicable socket types:: all
  266. ZMQ_IPV6: Enable IPv6 on socket
  267. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  268. Set the IPv6 option for the socket. A value of `1` means IPv6 is
  269. enabled on the socket, while `0` means the socket will use only IPv4.
  270. When IPv6 is enabled the socket will connect to, or accept connections
  271. from, both IPv4 and IPv6 hosts.
  272. [horizontal]
  273. Option value type:: int
  274. Option value unit:: boolean
  275. Default value:: 0 (false)
  276. Applicable socket types:: all, when using TCP transports.
  277. ZMQ_IPV4ONLY: Use IPv4-only on socket
  278. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  279. Set the IPv4-only option for the socket. This option is deprecated.
  280. Please use the ZMQ_IPV6 option.
  281. [horizontal]
  282. Option value type:: int
  283. Option value unit:: boolean
  284. Default value:: 1 (true)
  285. Applicable socket types:: all, when using TCP transports.
  286. ZMQ_IMMEDIATE: Queue messages only to completed connections
  287. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  288. By default queues will fill on outgoing connections even if the connection has
  289. not completed. This can lead to "lost" messages on sockets with round-robin
  290. routing (REQ, PUSH, DEALER). If this option is set to `1`, messages shall be
  291. queued only to completed connections. This will cause the socket to block if
  292. there are no other connections, but will prevent queues from filling on pipes
  293. awaiting connection.
  294. [horizontal]
  295. Option value type:: int
  296. Option value unit:: boolean
  297. Default value:: 0 (false)
  298. Applicable socket types:: all, only for connection-oriented transports.
  299. ZMQ_ROUTER_MANDATORY: accept only routable messages on ROUTER sockets
  300. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  301. Sets the 'ROUTER' socket behavior when an unroutable message is encountered. A
  302. value of `0` is the default and discards the message silently when it cannot be
  303. routed. A value of `1` returns an 'EHOSTUNREACH' error code if the message
  304. cannot be routed.
  305. [horizontal]
  306. Option value type:: int
  307. Option value unit:: 0, 1
  308. Default value:: 0
  309. Applicable socket types:: ZMQ_ROUTER
  310. ZMQ_ROUTER_RAW: switch ROUTER socket to raw mode
  311. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  312. Sets the raw mode on the 'ROUTER', when set to 1. When the ROUTER socket is in
  313. raw mode, and when using the tcp:// transport, it will read and write TCP data
  314. without 0MQ framing. This lets 0MQ applications talk to non-0MQ applications.
  315. When using raw mode, you cannot set explicit identities, and the ZMQ_MSGMORE
  316. flag is ignored when sending data messages. In raw mode you can close a specific
  317. connection by sending it a zero-length message (following the identity frame).
  318. [horizontal]
  319. Option value type:: int
  320. Option value unit:: 0, 1
  321. Default value:: 0
  322. Applicable socket types:: ZMQ_ROUTER
  323. ZMQ_XPUB_VERBOSE: provide all subscription messages on XPUB sockets
  324. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  325. Sets the 'XPUB' socket behavior on new subscriptions and unsubscriptions.
  326. A value of '0' is the default and passes only new subscription messages to
  327. upstream. A value of '1' passes all subscription messages upstream.
  328. [horizontal]
  329. Option value type:: int
  330. Option value unit:: 0, 1
  331. Default value:: 0
  332. Applicable socket types:: ZMQ_XPUB
  333. ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option
  334. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  335. Override 'SO_KEEPALIVE' socket option(where supported by OS).
  336. The default value of `-1` means to skip any overrides and leave it to OS default.
  337. [horizontal]
  338. Option value type:: int
  339. Option value unit:: -1,0,1
  340. Default value:: -1 (leave to OS default)
  341. Applicable socket types:: all, when using TCP transports.
  342. ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT(or TCP_KEEPALIVE on some OS)
  343. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  344. Override 'TCP_KEEPCNT'(or 'TCP_KEEPALIVE' on some OS) socket option(where supported by OS).
  345. The default value of `-1` means to skip any overrides and leave it to OS default.
  346. [horizontal]
  347. Option value type:: int
  348. Option value unit:: -1,>0
  349. Default value:: -1 (leave to OS default)
  350. Applicable socket types:: all, when using TCP transports.
  351. ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option
  352. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  353. Override 'TCP_KEEPCNT' socket option(where supported by OS).
  354. The default value of `-1` means to skip any overrides and leave it to OS default.
  355. [horizontal]
  356. Option value type:: int
  357. Option value unit:: -1,>0
  358. Default value:: -1 (leave to OS default)
  359. Applicable socket types:: all, when using TCP transports.
  360. ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option
  361. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  362. Override 'TCP_KEEPINTVL' socket option(where supported by OS).
  363. The default value of `-1` means to skip any overrides and leave it to OS default.
  364. [horizontal]
  365. Option value type:: int
  366. Option value unit:: -1,>0
  367. Default value:: -1 (leave to OS default)
  368. Applicable socket types:: all, when using TCP transports.
  369. ZMQ_TCP_ACCEPT_FILTER: Assign filters to allow new TCP connections
  370. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  371. Assign arbitrary number of filters that will be applied for each new TCP transport
  372. connection on a listening socket.
  373. If no filters applied, then TCP transport allows connections from any ip.
  374. If at least one filter is applied then new connection source ip should be matched.
  375. To clear all filters call zmq_setsockopt(socket, ZMQ_TCP_ACCEPT_FILTER, NULL, 0).
  376. Filter is a null-terminated string with ipv6 or ipv4 CIDR.
  377. [horizontal]
  378. Option value type:: binary data
  379. Option value unit:: N/A
  380. Default value:: no filters (allow from all)
  381. Applicable socket types:: all listening sockets, when using TCP transports.
  382. RETURN VALUE
  383. ------------
  384. The _zmq_setsockopt()_ function shall return zero if successful. Otherwise it
  385. shall return `-1` and set 'errno' to one of the values defined below.
  386. ERRORS
  387. ------
  388. *EINVAL*::
  389. The requested option _option_name_ is unknown, or the requested _option_len_ or
  390. _option_value_ is invalid.
  391. *ETERM*::
  392. The 0MQ 'context' associated with the specified 'socket' was terminated.
  393. *ENOTSOCK*::
  394. The provided 'socket' was invalid.
  395. *EINTR*::
  396. The operation was interrupted by delivery of a signal.
  397. EXAMPLE
  398. -------
  399. .Subscribing to messages on a 'ZMQ_SUB' socket
  400. ----
  401. /* Subscribe to all messages */
  402. rc = zmq_setsockopt (socket, ZMQ_SUBSCRIBE, "", 0);
  403. assert (rc == 0);
  404. /* Subscribe to messages prefixed with "ANIMALS.CATS" */
  405. rc = zmq_setsockopt (socket, ZMQ_SUBSCRIBE, "ANIMALS.CATS", 12);
  406. ----
  407. .Setting I/O thread affinity
  408. ----
  409. int64_t affinity;
  410. /* Incoming connections on TCP port 5555 shall be handled by I/O thread 1 */
  411. affinity = 1;
  412. rc = zmq_setsockopt (socket, ZMQ_AFFINITY, &affinity, sizeof affinity);
  413. assert (rc);
  414. rc = zmq_bind (socket, "tcp://lo:5555");
  415. assert (rc);
  416. /* Incoming connections on TCP port 5556 shall be handled by I/O thread 2 */
  417. affinity = 2;
  418. rc = zmq_setsockopt (socket, ZMQ_AFFINITY, &affinity, sizeof affinity);
  419. assert (rc);
  420. rc = zmq_bind (socket, "tcp://lo:5556");
  421. assert (rc);
  422. ----
  423. SEE ALSO
  424. --------
  425. linkzmq:zmq_getsockopt[3]
  426. linkzmq:zmq_socket[3]
  427. linkzmq:zmq[7]
  428. AUTHORS
  429. -------
  430. This 0MQ manual page was written by Martin Sustrik <sustrik@250bpm.com> and
  431. Martin Lucina <mato@kotelna.sk>.