1ZMQ_SETSOCKOPT(3)                 0MQ Manual                 ZMQ_SETSOCKOPT(3)
2
3
4

NAME

6       zmq_setsockopt - set 0MQ socket options
7

SYNOPSIS

9       int zmq_setsockopt (void *socket, int option_name, const void
10       *option_value, size_t option_len);
11
12       Caution: All options, with the exception of ZMQ_SUBSCRIBE,
13       ZMQ_UNSUBSCRIBE, ZMQ_LINGER, ZMQ_ROUTER_HANDOVER, ZMQ_ROUTER_MANDATORY,
14       ZMQ_PROBE_ROUTER, ZMQ_XPUB_VERBOSE, ZMQ_XPUB_VERBOSER,
15       ZMQ_REQ_CORRELATE, ZMQ_REQ_RELAXED, ZMQ_SNDHWM and ZMQ_RCVHWM, only
16       take effect for subsequent socket bind/connects.
17
18       Specifically, security options take effect for subsequent bind/connect
19       calls, and can be changed at any time to affect subsequent binds and/or
20       connects.
21

DESCRIPTION

23       The zmq_setsockopt() function shall set the option specified by the
24       option_name argument to the value pointed to by the option_value
25       argument for the 0MQ socket pointed to by the socket argument. The
26       option_len argument is the size of the option value in bytes. For
27       options taking a value of type "character string", the provided byte
28       data should either contain no zero bytes, or end in a single zero byte
29       (terminating ASCII NUL character).
30
31       The following socket options can be set with the zmq_setsockopt()
32       function:
33
34   ZMQ_AFFINITY: Set I/O thread affinity
35       The ZMQ_AFFINITY option shall set the I/O thread affinity for newly
36       created connections on the specified socket.
37
38       Affinity determines which threads from the 0MQ I/O thread pool
39       associated with the socket’s context shall handle newly created
40       connections. A value of zero specifies no affinity, meaning that work
41       shall be distributed fairly among all 0MQ I/O threads in the thread
42       pool. For non-zero values, the lowest bit corresponds to thread 1,
43       second lowest bit to thread 2 and so on. For example, a value of 3
44       specifies that subsequent connections on socket shall be handled
45       exclusively by I/O threads 1 and 2.
46
47       See also zmq_init(3) for details on allocating the number of I/O
48       threads for a specific context.
49
50
51       Option value type         uint64_t
52
53       Option value unit         N/A (bitmap)
54
55       Default value             0
56
57       Applicable socket types   N/A
58
59
60   ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections
61       The ZMQ_BACKLOG option shall set the maximum length of the queue of
62       outstanding peer connections for the specified socket; this only
63       applies to connection-oriented transports. For details refer to your
64       operating system documentation for the listen function.
65
66
67
68       Option value type         int
69
70       Option value unit         connections
71
72       Default value             100
73
74       Applicable socket types   all, only for
75                                 connection-oriented
76                                 transports.
77
78
79   ZMQ_BINDTODEVICE: Set name of device to bind the socket to
80       The ZMQ_BINDTODEVICE option binds this socket to a particular device,
81       eg. an interface or VRF. If a socket is bound to an interface, only
82       packets received from that particular interface are processed by the
83       socket. If device is a VRF device, then subsequent binds/connects to
84       that socket use addresses in the VRF routing table.
85
86           Note
87           requires setting CAP_NET_RAW on the compiled program.
88
89
90       Option value type         character string
91
92       Option value unit         N/A
93
94       Default value             not set
95
96       Applicable socket types   all, when using TCP or UDP
97                                 transports.
98
99
100   ZMQ_CONNECT_RID: Assign the next outbound connection id
101       This option name is now deprecated. Use ZMQ_CONNECT_ROUTING_ID instead.
102       ZMQ_CONNECT_RID remains as an alias for now.
103
104   ZMQ_CONNECT_ROUTING_ID: Assign the next outbound routing id
105       The ZMQ_CONNECT_ROUTING_ID option sets the peer id of the peer
106       connected via the next zmq_connect() call, such that that connection is
107       immediately ready for data transfer with the given routing id. This
108       option applies only to the first subsequent call to zmq_connect(),
109       zmq_connect() calls thereafter use the default connection behaviour.
110
111       Typical use is to set this socket option ahead of each zmq_connect()
112       call. Each connection MUST be assigned a unique routing id. Assigning a
113       routing id that is already in use is not allowed.
114
115       Useful when connecting ROUTER to ROUTER, or STREAM to STREAM, as it
116       allows for immediate sending to peers. Outbound routing id framing
117       requirements for ROUTER and STREAM sockets apply.
118
119       The routing id must be from 1 to 255 bytes long and MAY NOT start with
120       a zero byte (such routing ids are reserved for internal use by the 0MQ
121       infrastructure).
122
123
124       Option value type         binary data
125
126       Option value unit         N/A
127
128       Default value             NULL
129
130       Applicable socket types   ZMQ_ROUTER, ZMQ_STREAM
131
132
133   ZMQ_CONFLATE: Keep only last message
134       If set, a socket shall keep only one message in its inbound/outbound
135       queue, this message being the last message received/the last message to
136       be sent. Ignores ZMQ_RCVHWM and ZMQ_SNDHWM options. Does not support
137       multi-part messages, in particular, only one part of it is kept in the
138       socket internal queue.
139
140           Note
141           If recv is not called on the inbound socket, the queue and memory
142           will grow with each message received. Use zmq_getsockopt(3) with
143           ZMQ_EVENTS to trigger the conflation of the messages.
144
145
146       Option value type         int
147
148       Option value unit         boolean
149
150       Default value             0 (false)
151
152       Applicable socket types   ZMQ_PULL, ZMQ_PUSH,
153                                 ZMQ_SUB, ZMQ_PUB,
154                                 ZMQ_DEALER
155
156
157   ZMQ_CONNECT_TIMEOUT: Set connect() timeout
158       Sets how long to wait before timing-out a connect() system call. The
159       connect() system call normally takes a long time before it returns a
160       time out error. Setting this option allows the library to time out the
161       call at an earlier interval.
162
163
164       Option value type         int
165
166       Option value unit         milliseconds
167
168       Default value             0 (disabled)
169
170       Applicable socket types   all, when using TCP
171                                 transports.
172
173
174   ZMQ_CURVE_PUBLICKEY: Set CURVE public key
175       Sets the socket’s long term public key. You must set this on CURVE
176       client sockets, see zmq_curve(7). You can provide the key as 32 binary
177       bytes, or as a 40-character string encoded in the Z85 encoding format
178       and terminated in a null byte. The public key must always be used with
179       the matching secret key. To generate a public/secret key pair, use
180       zmq_curve_keypair(3). To derive the public key from a secret key, use
181       zmq_curve_public(3).
182
183           Note
184           an option value size of 40 is supported for backwards
185           compatibility, though is deprecated.
186
187
188       Option value type         binary data or Z85 text
189                                 string
190
191       Option value size         32 or 41
192
193       Default value             NULL
194
195       Applicable socket types   all, when using TCP
196                                 transport
197
198
199   ZMQ_CURVE_SECRETKEY: Set CURVE secret key
200       Sets the socket’s long term secret key. You must set this on both CURVE
201       client and server sockets, see zmq_curve(7). You can provide the key as
202       32 binary bytes, or as a 40-character string encoded in the Z85
203       encoding format and terminated in a null byte. To generate a
204       public/secret key pair, use zmq_curve_keypair(3). To derive the public
205       key from a secret key, use zmq_curve_public(3).
206
207           Note
208           an option value size of 40 is supported for backwards
209           compatibility, though is deprecated.
210
211
212       Option value type         binary data or Z85 text
213                                 string
214
215       Option value size         32 or 41
216
217       Default value             NULL
218
219       Applicable socket types   all, when using TCP
220                                 transport
221
222
223   ZMQ_CURVE_SERVER: Set CURVE server role
224       Defines whether the socket will act as server for CURVE security, see
225       zmq_curve(7). A value of 1 means the socket will act as CURVE server. A
226       value of 0 means the socket will not act as CURVE server, and its
227       security role then depends on other option settings. Setting this to 0
228       shall reset the socket security to NULL. When you set this you must
229       also set the server’s secret key using the ZMQ_CURVE_SECRETKEY option.
230       A server socket does not need to know its own public key.
231
232
233       Option value type         int
234
235       Option value unit         0, 1
236
237       Default value             0
238
239       Applicable socket types   all, when using TCP
240                                 transport
241
242
243   ZMQ_CURVE_SERVERKEY: Set CURVE server key
244       Sets the socket’s long term server key. You must set this on CURVE
245       client sockets, see zmq_curve(7). You can provide the key as 32 binary
246       bytes, or as a 40-character string encoded in the Z85 encoding format
247       and terminated in a null byte. This key must have been generated
248       together with the server’s secret key. To generate a public/secret key
249       pair, use zmq_curve_keypair(3).
250
251           Note
252           an option value size of 40 is supported for backwards
253           compatibility, though is deprecated.
254
255
256       Option value type         binary data or Z85 text
257                                 string
258
259       Option value size         32 or 41
260
261       Default value             NULL
262
263
264
265
266       Applicable socket types   all, when using TCP
267                                 transport
268
269
270   ZMQ_DISCONNECT_MSG: set a disconnect message that the socket will generate
271       when accepted peer disconnect
272       When set, the socket will generate a disconnect message when accepted
273       peer has been disconnected. You may set this on ROUTER, SERVER and PEER
274       sockets. The combination with ZMQ_HEARTBEAT_IVL is powerful and
275       simplify protocols, when heartbeat recognize a connection drop it will
276       generate a disconnect message that can match the protocol of the
277       application.
278
279
280       Option value type         binary data
281
282       Option value unit         N/A
283
284       Default value             NULL
285
286       Applicable socket types   ZMQ_ROUTER, ZMQ_SERVER and
287                                 ZMQ_PEER
288
289
290   ZMQ_GSSAPI_PLAINTEXT: Disable GSSAPI encryption
291       Defines whether communications on the socket will be encrypted, see
292       zmq_gssapi(7). A value of 1 means that communications will be
293       plaintext. A value of 0 means communications will be encrypted.
294
295
296       Option value type         int
297
298       Option value unit         0, 1
299
300       Default value             0 (false)
301
302       Applicable socket types   all, when using TCP
303                                 transport
304
305
306   ZMQ_GSSAPI_PRINCIPAL: Set name of GSSAPI principal
307       Sets the name of the principal for whom GSSAPI credentials should be
308       acquired.
309
310
311       Option value type         character string
312
313       Option value unit         N/A
314
315       Default value             not set
316
317       Applicable socket types   all, when using TCP
318                                 transport
319
320
321   ZMQ_GSSAPI_SERVER: Set GSSAPI server role
322       Defines whether the socket will act as server for GSSAPI security, see
323       zmq_gssapi(7). A value of 1 means the socket will act as GSSAPI server.
324       A value of 0 means the socket will act as GSSAPI client.
325
326
327       Option value type         int
328
329       Option value unit         0, 1
330
331
332       Default value             0 (false)
333
334       Applicable socket types   all, when using TCP
335                                 transport
336
337
338   ZMQ_GSSAPI_SERVICE_PRINCIPAL: Set name of GSSAPI service principal
339       Sets the name of the principal of the GSSAPI server to which a GSSAPI
340       client intends to connect.
341
342
343       Option value type         character string
344
345       Option value unit         N/A
346
347       Default value             not set
348
349       Applicable socket types   all, when using TCP
350                                 transport
351
352
353   ZMQ_GSSAPI_SERVICE_PRINCIPAL_NAMETYPE: Set name type of service principal
354       Sets the name type of the GSSAPI service principal. A value of
355       ZMQ_GSSAPI_NT_HOSTBASED (0) means the name specified with
356       ZMQ_GSSAPI_SERVICE_PRINCIPAL is interpreted as a host based name. A
357       value of ZMQ_GSSAPI_NT_USER_NAME (1) means it is interpreted as a local
358       user name. A value of ZMQ_GSSAPI_NT_KRB5_PRINCIPAL (2) means it is
359       interpreted as an unparsed principal name string (valid only with the
360       krb5 GSSAPI mechanism).
361
362
363       Option value type         int
364
365       Option value unit         0, 1, 2
366
367       Default value             0
368                                 (ZMQ_GSSAPI_NT_HOSTBASED)
369
370       Applicable socket types   all, when using TCP or IPC
371                                 transport
372
373
374   ZMQ_GSSAPI_PRINCIPAL_NAMETYPE: Set name type of principal
375       Sets the name type of the GSSAPI principal. A value of
376       ZMQ_GSSAPI_NT_HOSTBASED (0) means the name specified with
377       ZMQ_GSSAPI_PRINCIPAL is interpreted as a host based name. A value of
378       ZMQ_GSSAPI_NT_USER_NAME (1) means it is interpreted as a local user
379       name. A value of ZMQ_GSSAPI_NT_KRB5_PRINCIPAL (2) means it is
380       interpreted as an unparsed principal name string (valid only with the
381       krb5 GSSAPI mechanism).
382
383
384       Option value type         int
385
386       Option value unit         0, 1, 2
387
388       Default value             0
389                                 (ZMQ_GSSAPI_NT_HOSTBASED)
390
391       Applicable socket types   all, when using TCP or IPC
392                                 transport
393
394
395   ZMQ_HANDSHAKE_IVL: Set maximum handshake interval
396       The ZMQ_HANDSHAKE_IVL option shall set the maximum handshake interval
397       for the specified socket. Handshaking is the exchange of socket
398       configuration information (socket type, routing id, security) that
399       occurs when a connection is first opened, only for connection-oriented
400       transports. If handshaking does not complete within the configured
401       time, the connection shall be closed. The value 0 means no handshake
402       time limit.
403
404
405       Option value type         int
406
407       Option value unit         milliseconds
408
409       Default value             30000
410
411       Applicable socket types   all but ZMQ_STREAM, only
412                                 for connection-oriented
413                                 transports
414
415
416   ZMQ_HELLO_MSG: set an hello message that will be sent when a new peer
417       connect
418       When set, the socket will automatically send an hello message when a
419       new connection is made or accepted. You may set this on DEALER, ROUTER,
420       CLIENT, SERVER and PEER sockets. The combination with ZMQ_HEARTBEAT_IVL
421       is powerful and simplify protocols, as now heartbeat and sending the
422       hello message can be left out of protocols and be handled by zeromq.
423
424
425       Option value type         binary data
426
427       Option value unit         N/A
428
429       Default value             NULL
430
431       Applicable socket types   ZMQ_ROUTER, ZMQ_DEALER,
432                                 ZMQ_CLIENT, ZMQ_SERVER and
433                                 ZMQ_PEER
434
435
436   ZMQ_HEARTBEAT_IVL: Set interval between sending ZMTP heartbeats
437       The ZMQ_HEARTBEAT_IVL option shall set the interval between sending
438       ZMTP heartbeats for the specified socket. If this option is set and is
439       greater than 0, then a PING ZMTP command will be sent every
440       ZMQ_HEARTBEAT_IVL milliseconds.
441
442
443       Option value type         int
444
445       Option value unit         milliseconds
446
447       Default value             0
448
449       Applicable socket types   all, when using
450                                 connection-oriented
451                                 transports
452
453
454   ZMQ_HEARTBEAT_TIMEOUT: Set timeout for ZMTP heartbeats
455       The ZMQ_HEARTBEAT_TIMEOUT option shall set how long to wait before
456       timing-out a connection after sending a PING ZMTP command and not
457       receiving any traffic. This option is only valid if ZMQ_HEARTBEAT_IVL
458       is also set, and is greater than 0. The connection will time out if
459       there is no traffic received after sending the PING command, but the
460       received traffic does not have to be a PONG command - any received
461       traffic will cancel the timeout.
462
463
464
465
466       Option value type         int
467
468       Option value unit         milliseconds
469
470       Default value             0 normally,
471                                 ZMQ_HEARTBEAT_IVL if it is
472                                 set
473
474       Applicable socket types   all, when using
475                                 connection-oriented
476                                 transports
477
478
479   ZMQ_HEARTBEAT_TTL: Set the TTL value for ZMTP heartbeats
480       The ZMQ_HEARTBEAT_TTL option shall set the timeout on the remote peer
481       for ZMTP heartbeats. If this option is greater than 0, the remote side
482       shall time out the connection if it does not receive any more traffic
483       within the TTL period. This option does not have any effect if
484       ZMQ_HEARTBEAT_IVL is not set or is 0. Internally, this value is rounded
485       down to the nearest decisecond, any value less than 100 will have no
486       effect.
487
488
489       Option value type         int
490
491       Option value unit         milliseconds
492
493       Default value             0
494
495       Maximum value             6553599 (which is 2^16-1
496                                 deciseconds)
497
498       Applicable socket types   all, when using
499                                 connection-oriented
500                                 transports
501
502
503   ZMQ_IDENTITY: Set socket identity
504       This option name is now deprecated. Use ZMQ_ROUTING_ID instead.
505       ZMQ_IDENTITY remains as an alias for now.
506
507   ZMQ_IMMEDIATE: Queue messages only to completed connections
508       By default queues will fill on outgoing connections even if the
509       connection has not completed. This can lead to "lost" messages on
510       sockets with round-robin routing (REQ, PUSH, DEALER). If this option is
511       set to 1, messages shall be queued only to completed connections. This
512       will cause the socket to block if there are no other connections, but
513       will prevent queues from filling on pipes awaiting connection.
514
515
516       Option value type         int
517
518       Option value unit         boolean
519
520       Default value             0 (false)
521
522       Applicable socket types   all, only for
523                                 connection-oriented
524                                 transports.
525
526
527   ZMQ_INVERT_MATCHING: Invert message filtering
528       Reverses the filtering behavior of PUB-SUB sockets, when set to 1.
529
530       On PUB and XPUB sockets, this causes messages to be sent to all
531       connected sockets except those subscribed to a prefix that matches the
532       message. On SUB sockets, this causes only incoming messages that do not
533       match any of the socket’s subscriptions to be received by the user.
534
535       Whenever ZMQ_INVERT_MATCHING is set to 1 on a PUB socket, all SUB
536       sockets connecting to it must also have the option set to 1. Failure to
537       do so will have the SUB sockets reject everything the PUB socket sends
538       them. XSUB sockets do not need to do this because they do not filter
539       incoming messages.
540
541
542       Option value type         int
543
544       Option value unit         0,1
545
546       Default value             0
547
548       Applicable socket types   ZMQ_PUB, ZMQ_XPUB, ZMQ_SUB
549
550
551   ZMQ_IPV6: Enable IPv6 on socket
552       Set the IPv6 option for the socket. A value of 1 means IPv6 is enabled
553       on the socket, while 0 means the socket will use only IPv4. When IPv6
554       is enabled the socket will connect to, or accept connections from, both
555       IPv4 and IPv6 hosts.
556
557
558       Option value type         int
559
560       Option value unit         boolean
561
562       Default value             0 (false)
563
564       Applicable socket types   all, when using TCP
565                                 transports.
566
567
568   ZMQ_LINGER: Set linger period for socket shutdown
569       The ZMQ_LINGER option shall set the linger period for the specified
570       socket. The linger period determines how long pending messages which
571       have yet to be sent to a peer shall linger in memory after a socket is
572       disconnected with zmq_disconnect(3) or closed with zmq_close(3), and
573       further affects the termination of the socket’s context with
574       zmq_ctx_term(3). The following outlines the different behaviours:
575
576       •   A value of -1 specifies an infinite linger period. Pending messages
577           shall not be discarded after a call to zmq_disconnect() or
578           zmq_close(); attempting to terminate the socket’s context with
579           zmq_ctx_term() shall block until all pending messages have been
580           sent to a peer.
581
582       •   The value of 0 specifies no linger period. Pending messages shall
583           be discarded immediately after a call to zmq_disconnect() or
584           zmq_close().
585
586       •   Positive values specify an upper bound for the linger period in
587           milliseconds. Pending messages shall not be discarded after a call
588           to zmq_disconnect() or zmq_close(); attempting to terminate the
589           socket’s context with zmq_ctx_term() shall block until either all
590           pending messages have been sent to a peer, or the linger period
591           expires, after which any pending messages shall be discarded.
592
593           Option value type         int
594           Option value unit         milliseconds
595           Default value             -1 (infinite)
596           Applicable socket types   all
597
598
599   ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size
600       Limits the size of the inbound message. If a peer sends a message
601       larger than ZMQ_MAXMSGSIZE it is disconnected. Value of -1 means no
602       limit.
603
604
605       Option value type         int64_t
606
607       Option value unit         bytes
608
609       Default value             -1
610
611       Applicable socket types   all
612
613
614   ZMQ_METADATA: Add application metadata properties to a socket
615       The ZMQ_METADATA option shall add application metadata to the specified
616       socket, the metadata is exchanged with peers during connection setup. A
617       metadata property is specfied as a string, delimited by a colon,
618       starting with the metadata property followed by the metadata value, for
619       example "X-key:value". Property names are restrited to maximum 255
620       characters and must be prefixed by "X-". Multiple application metadata
621       properties can be added to a socket by executing zmq_setsockopt()
622       multiple times. As the argument is a null-terminated string, binary
623       data must be encoded before it is added e.g. using Z85
624       (zmq_z85_encode(3)).
625
626           Note
627           in DRAFT state, not yet available in stable releases.
628
629
630       Option value type         character string
631
632       Option value unit         N/A
633
634       Default value             not set
635
636       Applicable socket types   all
637
638
639   ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets
640       Sets the time-to-live field in every multicast packet sent from this
641       socket. The default is 1 which means that the multicast packets don’t
642       leave the local network.
643
644
645       Option value type         int
646
647       Option value unit         network hops
648
649       Default value             1
650
651       Applicable socket types   all, when using multicast
652                                 transports
653
654
655   ZMQ_MULTICAST_MAXTPDU: Maximum transport data unit size for multicast
656       packets
657       Sets the maximum transport data unit size used for outbound multicast
658       packets.
659
660       This must be set at or below the minimum Maximum Transmission Unit
661       (MTU) for all network paths over which multicast reception is required.
662
663
664       Option value type         int
665
666
667       Option value unit         bytes
668
669       Default value             1500
670
671       Applicable socket types   all, when using multicast
672                                 transports
673
674
675   ZMQ_PLAIN_PASSWORD: Set PLAIN security password
676       Sets the password for outgoing connections over TCP or IPC. If you set
677       this to a non-null value, the security mechanism used for connections
678       shall be PLAIN, see zmq_plain(7). If you set this to a null value, the
679       security mechanism used for connections shall be NULL, see zmq_null(3).
680
681
682       Option value type         character string
683
684       Option value unit         N/A
685
686       Default value             not set
687
688       Applicable socket types   all, when using TCP
689                                 transport
690
691
692   ZMQ_PLAIN_SERVER: Set PLAIN server role
693       Defines whether the socket will act as server for PLAIN security, see
694       zmq_plain(7). A value of 1 means the socket will act as PLAIN server. A
695       value of 0 means the socket will not act as PLAIN server, and its
696       security role then depends on other option settings. Setting this to 0
697       shall reset the socket security to NULL.
698
699
700       Option value type         int
701
702       Option value unit         0, 1
703
704       Default value             0
705
706       Applicable socket types   all, when using TCP
707                                 transport
708
709
710   ZMQ_PLAIN_USERNAME: Set PLAIN security username
711       Sets the username for outgoing connections over TCP or IPC. If you set
712       this to a non-null value, the security mechanism used for connections
713       shall be PLAIN, see zmq_plain(7). If you set this to a null value, the
714       security mechanism used for connections shall be NULL, see zmq_null(3).
715
716
717       Option value type         character string
718
719       Option value unit         N/A
720
721       Default value             not set
722
723       Applicable socket types   all, when using TCP
724                                 transport
725
726
727   ZMQ_USE_FD: Set the pre-allocated socket file descriptor
728       When set to a positive integer value before zmq_bind is called on the
729       socket, the socket shall use the corresponding file descriptor for
730       connections over TCP or IPC instead of allocating a new file
731       descriptor. Useful for writing systemd socket activated services. If
732       set to -1 (default), a new file descriptor will be allocated instead
733       (default behaviour).
734
735           Note
736           if set after calling zmq_bind, this option shall have no effect.
737           NOTE: the file descriptor passed through MUST have been ran through
738           the "bind" and "listen" system calls beforehand. Also, socket
739           option that would normally be passed through zmq_setsockopt like
740           TCP buffers length, IP_TOS or SO_REUSEADDR MUST be set beforehand
741           by the caller, as they must be set before the socket is bound.
742
743
744       Option value type         int
745
746       Option value unit         file descriptor
747
748       Default value             -1
749
750       Applicable socket types   all bound sockets, when
751                                 using IPC or TCP transport
752
753
754   ZMQ_PRIORITY: Set the Priority on socket
755       Sets the protocol-defined priority for all packets to be sent on this
756       socket, where supported by the OS. In Linux, values greater than 6
757       require admin capability (CAP_NET_ADMIN)
758
759
760       Option value type         int
761
762       Option value unit         >0
763
764       Default value             0
765
766       Applicable socket types   all, only for
767                                 connection-oriented
768                                 transports
769
770
771   ZMQ_PROBE_ROUTER: bootstrap connections to ROUTER sockets
772       When set to 1, the socket will automatically send an empty message when
773       a new connection is made or accepted. You may set this on REQ, DEALER,
774       or ROUTER sockets connected to a ROUTER socket. The application must
775       filter such empty messages. The ZMQ_PROBE_ROUTER option in effect
776       provides the ROUTER application with an event signaling the arrival of
777       a new peer.
778
779           Note
780           do not set this option on a socket that talks to any other socket
781           types: the results are undefined.
782
783
784       Option value type         int
785
786       Option value unit         0, 1
787
788       Default value             0
789
790       Applicable socket types   ZMQ_ROUTER, ZMQ_DEALER,
791                                 ZMQ_REQ
792
793
794   ZMQ_RATE: Set multicast data rate
795       The ZMQ_RATE option shall set the maximum send or receive data rate for
796       multicast transports such as zmq_pgm(7) using the specified socket.
797
798
799
800
801       Option value type         int
802
803       Option value unit         kilobits per second
804
805       Default value             100
806
807       Applicable socket types   all, when using multicast
808                                 transports
809
810
811   ZMQ_RCVBUF: Set kernel receive buffer size
812       The ZMQ_RCVBUF option shall set the underlying kernel receive buffer
813       size for the socket to the specified size in bytes. A value of -1 means
814       leave the OS default unchanged. For details refer to your operating
815       system documentation for the SO_RCVBUF socket option.
816
817
818       Option value type         int
819
820       Option value unit         bytes
821
822       Default value             -1
823
824       Applicable socket types   all
825
826
827   ZMQ_RCVHWM: Set high water mark for inbound messages
828       The ZMQ_RCVHWM option shall set the high water mark for inbound
829       messages on the specified socket. The high water mark is a hard limit
830       on the maximum number of outstanding messages 0MQ shall queue in memory
831       for any single peer that the specified socket is communicating with. A
832       value of zero means no limit.
833
834       If this limit has been reached the socket shall enter an exceptional
835       state and depending on the socket type, 0MQ shall take appropriate
836       action such as blocking or dropping sent messages. Refer to the
837       individual socket descriptions in zmq_socket(3) for details on the
838       exact action taken for each socket type.
839
840           Note
841           0MQ does not guarantee that the socket will be able to queue as
842           many as ZMQ_RCVHWM messages, and the actual limit may be lower or
843           higher, depending on socket transport. A notable example is for
844           sockets using TCP transport; see zmq_tcp(7).
845
846
847       Option value type         int
848
849       Option value unit         messages
850
851       Default value             1000
852
853       Applicable socket types   all
854
855
856   ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN
857       Sets the timeout for receive operation on the socket. If the value is
858       0, zmq_recv(3) will return immediately, with a EAGAIN error if there is
859       no message to receive. If the value is -1, it will block until a
860       message is available. For all other values, it will wait for a message
861       for that amount of time before returning with an EAGAIN error.
862
863
864       Option value type         int
865
866
867
868       Option value unit         milliseconds
869
870       Default value             -1 (infinite)
871
872       Applicable socket types   all
873
874
875   ZMQ_RECONNECT_IVL: Set reconnection interval
876       The ZMQ_RECONNECT_IVL option shall set the initial reconnection
877       interval for the specified socket. The reconnection interval is the
878       period 0MQ shall wait between attempts to reconnect disconnected peers
879       when using connection-oriented transports. The value -1 means no
880       reconnection.
881
882           Note
883           The reconnection interval may be randomized by 0MQ to prevent
884           reconnection storms in topologies with a large number of peers per
885           socket.
886
887
888       Option value type         int
889
890       Option value unit         milliseconds
891
892       Default value             100
893
894       Applicable socket types   all, only for
895                                 connection-oriented
896                                 transports
897
898
899   ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval
900       The ZMQ_RECONNECT_IVL_MAX option shall set the maximum reconnection
901       interval for the specified socket. This is the maximum period 0MQ shall
902       wait between attempts to reconnect. On each reconnect attempt, the
903       previous interval shall be doubled untill ZMQ_RECONNECT_IVL_MAX is
904       reached. This allows for exponential backoff strategy. Default value
905       means no exponential backoff is performed and reconnect interval
906       calculations are only based on ZMQ_RECONNECT_IVL.
907
908           Note
909           Values less than ZMQ_RECONNECT_IVL will be ignored.
910
911
912       Option value type         int
913
914       Option value unit         milliseconds
915
916       Default value             0 (only use
917                                 ZMQ_RECONNECT_IVL)
918
919       Applicable socket types   all, only for
920                                 connection-oriented
921                                 transports
922
923
924   ZMQ_RECONNECT_STOP: Set condition where reconnection will stop
925       The ZMQ_RECONNECT_STOP option shall set the conditions under which
926       automatic reconnection will stop. This can be useful when a process
927       binds to a wild-card port, where the OS supplies an ephemeral port.
928
929       The ZMQ_RECONNECT_STOP_CONN_REFUSED option will stop reconnection when
930       0MQ receives the ECONNREFUSED return code from the connect. This
931       indicates that there is no code bound to the specified endpoint.
932
933       The ZMQ_RECONNECT_STOP_HANDSHAKE_FAILED option will stop reconnection
934       if the 0MQ handshake fails. This can be used to detect and/or prevent
935       errant connection attempts to non-0MQ sockets. Note that when
936       specifying this option you may also want to set ZMQ_HANDSHAKE_IVL — the
937       default handshake interval is 30000 (30 seconds), which is typically
938       too large.
939
940       The ZMQ_RECONNECT_STOP_AFTER_DISCONNECT option will stop reconnection
941       when zmq_disconnect() has been called. This can be useful when the
942       user’s request failed (server not ready), as the socket does not need
943       to continue to reconnect after user disconnect actively.
944
945           Note
946           in DRAFT state, not yet available in stable releases.
947
948
949       Option value type         int
950
951       Option value unit         0,
952                                 ZMQ_RECONNECT_STOP_CONN_REFUSED,
953                                 ZMQ_RECONNECT_STOP_HANDSHAKE_FAILED,
954                                 ZMQ_RECONNECT_STOP_CONN_REFUSED
955                                 |
956                                 ZMQ_RECONNECT_STOP_HANDSHAKE_FAILED
957
958       Default value             0
959
960       Applicable socket types   all, only for connection-oriented
961                                 transports (ZMQ_HANDSHAKE_IVL is not
962                                 applicable for ZMQ_STREAM sockets)
963
964
965   ZMQ_RECOVERY_IVL: Set multicast recovery interval
966       The ZMQ_RECOVERY_IVL option shall set the recovery interval for
967       multicast transports using the specified socket. The recovery interval
968       determines the maximum time in milliseconds that a receiver can be
969       absent from a multicast group before unrecoverable data loss will
970       occur.
971
972           Caution
973           Exercise care when setting large recovery intervals as the data
974           needed for recovery will be held in memory. For example, a 1 minute
975           recovery interval at a data rate of 1Gbps requires a 7GB in-memory
976           buffer.
977
978
979       Option value type         int
980
981       Option value unit         milliseconds
982
983       Default value             10000
984
985       Applicable socket types   all, when using multicast
986                                 transports
987
988
989   ZMQ_REQ_CORRELATE: match replies with requests
990       The default behaviour of REQ sockets is to rely on the ordering of
991       messages to match requests and responses and that is usually
992       sufficient. When this option is set to 1, the REQ socket will prefix
993       outgoing messages with an extra frame containing a request id. That
994       means the full message is (request id, 0, user frames...). The REQ
995       socket will discard all incoming messages that don’t begin with these
996       two frames.
997
998
999       Option value type         int
1000
1001
1002       Option value unit         0, 1
1003
1004       Default value             0
1005
1006       Applicable socket types   ZMQ_REQ
1007
1008
1009   ZMQ_REQ_RELAXED: relax strict alternation between request and reply
1010       By default, a REQ socket does not allow initiating a new request with
1011       zmq_send(3) until the reply to the previous one has been received. When
1012       set to 1, sending another message is allowed and previous replies will
1013       be discarded if any. The request-reply state machine is reset and a new
1014       request is sent to the next available peer.
1015
1016       If set to 1, also enable ZMQ_REQ_CORRELATE to ensure correct matching
1017       of requests and replies. Otherwise a late reply to an aborted request
1018       can be reported as the reply to the superseding request.
1019
1020
1021       Option value type         int
1022
1023       Option value unit         0, 1
1024
1025       Default value             0
1026
1027       Applicable socket types   ZMQ_REQ
1028
1029
1030   ZMQ_ROUTER_HANDOVER: handle duplicate client routing ids on ROUTER sockets
1031       If two clients use the same routing id when connecting to a ROUTER, the
1032       results shall depend on the ZMQ_ROUTER_HANDOVER option setting. If that
1033       is not set (or set to the default of zero), the ROUTER socket shall
1034       reject clients trying to connect with an already-used routing id. If
1035       that option is set to 1, the ROUTER socket shall hand-over the
1036       connection to the new client and disconnect the existing one.
1037
1038
1039       Option value type         int
1040
1041       Option value unit         0, 1
1042
1043       Default value             0
1044
1045       Applicable socket types   ZMQ_ROUTER
1046
1047
1048   ZMQ_ROUTER_MANDATORY: accept only routable messages on ROUTER sockets
1049       Sets the ROUTER socket behaviour when an unroutable message is
1050       encountered. A value of 0 is the default and discards the message
1051       silently when it cannot be routed or the peers SNDHWM is reached. A
1052       value of 1 returns an EHOSTUNREACH error code if the message cannot be
1053       routed or EAGAIN error code if the SNDHWM is reached and ZMQ_DONTWAIT
1054       was used. Without ZMQ_DONTWAIT it will block until the SNDTIMEO is
1055       reached or a spot in the send queue opens up.
1056
1057       When ZMQ_ROUTER_MANDATORY is set to 1, ZMQ_POLLOUT events will be
1058       generated if one or more messages can be sent to at least one of the
1059       peers. If ZMQ_ROUTER_MANDATORY is set to 0, the socket will generate a
1060       ZMQ_POLLOUT event on every call to zmq_poll resp. zmq_poller_wait_all.
1061
1062
1063       Option value type         int
1064
1065       Option value unit         0, 1
1066
1067
1068
1069       Default value             0
1070
1071       Applicable socket types   ZMQ_ROUTER
1072
1073
1074   ZMQ_ROUTER_RAW: switch ROUTER socket to raw mode
1075       Sets the raw mode on the ROUTER, when set to 1. When the ROUTER socket
1076       is in raw mode, and when using the tcp:// transport, it will read and
1077       write TCP data without 0MQ framing. This lets 0MQ applications talk to
1078       non-0MQ applications. When using raw mode, you cannot set explicit
1079       identities, and the ZMQ_SNDMORE flag is ignored when sending data
1080       messages. In raw mode you can close a specific connection by sending it
1081       a zero-length message (following the routing id frame).
1082
1083           Note
1084           This option is deprecated, please use ZMQ_STREAM sockets instead.
1085
1086
1087       Option value type         int
1088
1089       Option value unit         0, 1
1090
1091       Default value             0
1092
1093       Applicable socket types   ZMQ_ROUTER
1094
1095
1096   ZMQ_ROUTING_ID: Set socket routing id
1097       The ZMQ_ROUTING_ID option shall set the routing id of the specified
1098       socket when connecting to a ROUTER socket.
1099
1100       A routing id must be at least one byte and at most 255 bytes long.
1101       Identities starting with a zero byte are reserved for use by the 0MQ
1102       infrastructure.
1103
1104       If two clients use the same routing id when connecting to a ROUTER, the
1105       results shall depend on the ZMQ_ROUTER_HANDOVER option setting. If that
1106       is not set (or set to the default of zero), the ROUTER socket shall
1107       reject clients trying to connect with an already-used routing id. If
1108       that option is set to 1, the ROUTER socket shall hand-over the
1109       connection to the new client and disconnect the existing one.
1110
1111
1112       Option value type         binary data
1113
1114       Option value unit         N/A
1115
1116       Default value             NULL
1117
1118       Applicable socket types   ZMQ_REQ, ZMQ_REP,
1119                                 ZMQ_ROUTER, ZMQ_DEALER.
1120
1121
1122   ZMQ_SNDBUF: Set kernel transmit buffer size
1123       The ZMQ_SNDBUF option shall set the underlying kernel transmit buffer
1124       size for the socket to the specified size in bytes. A value of -1 means
1125       leave the OS default unchanged. For details please refer to your
1126       operating system documentation for the SO_SNDBUF socket option.
1127
1128
1129       Option value type         int
1130
1131       Option value unit         bytes
1132
1133       Default value             -1
1134
1135
1136       Applicable socket types   all
1137
1138
1139   ZMQ_SNDHWM: Set high water mark for outbound messages
1140       The ZMQ_SNDHWM option shall set the high water mark for outbound
1141       messages on the specified socket. The high water mark is a hard limit
1142       on the maximum number of outstanding messages 0MQ shall queue in memory
1143       for any single peer that the specified socket is communicating with. A
1144       value of zero means no limit.
1145
1146       If this limit has been reached the socket shall enter an exceptional
1147       state and depending on the socket type, 0MQ shall take appropriate
1148       action such as blocking or dropping sent messages. Refer to the
1149       individual socket descriptions in zmq_socket(3) for details on the
1150       exact action taken for each socket type.
1151
1152           Note
1153           0MQ does not guarantee that the socket will accept as many as
1154           ZMQ_SNDHWM messages, and the actual limit may be as much as 90%
1155           lower depending on the flow of messages on the socket. The socket
1156           may even be able to accept more messages than the ZMQ_SNDHWM
1157           threshold; a notable example is for sockets using TCP transport;
1158           see zmq_tcp(7).
1159
1160
1161       Option value type         int
1162
1163       Option value unit         messages
1164
1165       Default value             1000
1166
1167       Applicable socket types   all
1168
1169
1170   ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN
1171       Sets the timeout for send operation on the socket. If the value is 0,
1172       zmq_send(3) will return immediately, with a EAGAIN error if the message
1173       cannot be sent. If the value is -1, it will block until the message is
1174       sent. For all other values, it will try to send the message for that
1175       amount of time before returning with an EAGAIN error.
1176
1177
1178       Option value type         int
1179
1180       Option value unit         milliseconds
1181
1182       Default value             -1 (infinite)
1183
1184       Applicable socket types   all
1185
1186
1187   ZMQ_SOCKS_PROXY: Set SOCKS5 proxy address
1188       Sets the SOCKS5 proxy address that shall be used by the socket for the
1189       TCP connection(s). Supported authentication methods are: no
1190       authentication or basic authentication when setup with
1191       ZMQ_SOCKS_USERNAME. If the endpoints are domain names instead of
1192       addresses they shall not be resolved and they shall be forwarded
1193       unchanged to the SOCKS proxy service in the client connection request
1194       message (address type 0x03 domain name).
1195
1196
1197       Option value type         character string
1198
1199       Option value unit         N/A
1200
1201
1202
1203       Default value             not set
1204
1205       Applicable socket types   all, when using TCP
1206                                 transport
1207
1208
1209   ZMQ_SOCKS_USERNAME: Set SOCKS username and select basic authentication
1210       Sets the username for authenticated connection to the SOCKS5 proxy. If
1211       you set this to a non-null and non-empty value, the authentication
1212       method used for the SOCKS5 connection shall be basic authentication. In
1213       this case, use ZMQ_SOCKS_PASSWORD option in order to set the password.
1214       If you set this to a null value or empty value, the authentication
1215       method shall be no authentication, the default.
1216
1217
1218       Option value type         character string
1219
1220       Option value unit         N/A
1221
1222       Default value             not set
1223
1224       Applicable socket types   all, when using TCP
1225                                 transport
1226
1227
1228   ZMQ_SOCKS_PASSWORD: Set SOCKS basic authentication password
1229       Sets the password for authenticating to the SOCKS5 proxy server. This
1230       is used only when the SOCKS5 authentication method has been set to
1231       basic authentication through the ZMQ_SOCKS_USERNAME option. Setting
1232       this to a null value (the default) is equivalent to an empty password
1233       string.
1234
1235
1236       Option value type         character string
1237
1238       Option value unit         N/A
1239
1240       Default value             not set
1241
1242       Applicable socket types   all, when using TCP
1243                                 transport
1244
1245
1246   ZMQ_STREAM_NOTIFY: send connect and disconnect notifications
1247       Enables connect and disconnect notifications on a STREAM socket, when
1248       set to 1. When notifications are enabled, the socket delivers a
1249       zero-length message when a peer connects or disconnects.
1250
1251
1252       Option value type         int
1253
1254       Option value unit         0, 1
1255
1256       Default value             1
1257
1258       Applicable socket types   ZMQ_STREAM
1259
1260
1261   ZMQ_SUBSCRIBE: Establish message filter
1262       The ZMQ_SUBSCRIBE option shall establish a new message filter on a
1263       ZMQ_SUB socket. Newly created ZMQ_SUB sockets shall filter out all
1264       incoming messages, therefore you should call this option to establish
1265       an initial message filter.
1266
1267       An empty option_value of length zero shall subscribe to all incoming
1268       messages. A non-empty option_value shall subscribe to all messages
1269       beginning with the specified prefix. Multiple filters may be attached
1270       to a single ZMQ_SUB socket, in which case a message shall be accepted
1271       if it matches at least one filter.
1272
1273
1274       Option value type         binary data
1275
1276       Option value unit         N/A
1277
1278       Default value             N/A
1279
1280       Applicable socket types   ZMQ_SUB
1281
1282
1283   ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option
1284       Override SO_KEEPALIVE socket option (where supported by OS). The
1285       default value of -1 means to skip any overrides and leave it to OS
1286       default.
1287
1288
1289       Option value type         int
1290
1291       Option value unit         -1,0,1
1292
1293       Default value             -1 (leave to OS default)
1294
1295       Applicable socket types   all, when using TCP
1296                                 transports.
1297
1298
1299   ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option
1300       Override TCP_KEEPCNT socket option (where supported by OS). The default
1301       value of -1 means to skip any overrides and leave it to OS default.
1302
1303
1304       Option value type         int
1305
1306       Option value unit         -1,>0
1307
1308       Default value             -1 (leave to OS default)
1309
1310       Applicable socket types   all, when using TCP
1311                                 transports.
1312
1313
1314   ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPIDLE (or TCP_KEEPALIVE on some OS)
1315       Override TCP_KEEPIDLE (or TCP_KEEPALIVE on some OS) socket option
1316       (where supported by OS). The default value of -1 means to skip any
1317       overrides and leave it to OS default.
1318
1319
1320       Option value type         int
1321
1322       Option value unit         -1,>0
1323
1324       Default value             -1 (leave to OS default)
1325
1326       Applicable socket types   all, when using TCP
1327                                 transports.
1328
1329
1330   ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option
1331       Override TCP_KEEPINTVL socket option(where supported by OS). The
1332       default value of -1 means to skip any overrides and leave it to OS
1333       default.
1334
1335
1336
1337       Option value type         int
1338
1339       Option value unit         -1,>0
1340
1341       Default value             -1 (leave to OS default)
1342
1343       Applicable socket types   all, when using TCP
1344                                 transports.
1345
1346
1347   ZMQ_TCP_MAXRT: Set TCP Maximum Retransmit Timeout
1348       On OSes where it is supported, sets how long before an unacknowledged
1349       TCP retransmit times out. The system normally attempts many TCP
1350       retransmits following an exponential backoff strategy. This means that
1351       after a network outage, it may take a long time before the session can
1352       be re-established. Setting this option allows the timeout to happen at
1353       a shorter interval.
1354
1355
1356       Option value type         int
1357
1358       Option value unit         milliseconds
1359
1360       Default value             0 (leave to OS default)
1361
1362       Applicable socket types   all, when using TCP
1363                                 transports.
1364
1365
1366   ZMQ_TOS: Set the Type-of-Service on socket
1367       Sets the ToS fields (Differentiated services (DS) and Explicit
1368       Congestion Notification (ECN) field of the IP header. The ToS field is
1369       typically used to specify a packets priority. The availability of this
1370       option is dependent on intermediate network equipment that inspect the
1371       ToS field and provide a path for low-delay, high-throughput,
1372       highly-reliable service, etc.
1373
1374
1375       Option value type         int
1376
1377       Option value unit         >0
1378
1379       Default value             0
1380
1381       Applicable socket types   all, only for
1382                                 connection-oriented
1383                                 transports
1384
1385
1386   ZMQ_UNSUBSCRIBE: Remove message filter
1387       The ZMQ_UNSUBSCRIBE option shall remove an existing message filter on a
1388       ZMQ_SUB socket. The filter specified must match an existing filter
1389       previously established with the ZMQ_SUBSCRIBE option. If the socket has
1390       several instances of the same filter attached the ZMQ_UNSUBSCRIBE
1391       option shall remove only one instance, leaving the rest in place and
1392       functional.
1393
1394
1395       Option value type         binary data
1396
1397       Option value unit         N/A
1398
1399       Default value             N/A
1400
1401       Applicable socket types   ZMQ_SUB
1402
1403
1404   ZMQ_XPUB_VERBOSE: pass duplicate subscribe messages on XPUB socket
1405       Sets the XPUB socket behaviour on new duplicated subscriptions. If
1406       enabled, the socket passes all subscribe messages to the caller. If
1407       disabled, only the first subscription to each filter will be passed.
1408       The default is 0 (disabled).
1409
1410
1411       Option value type         int
1412
1413       Option value unit         0, 1
1414
1415       Default value             0
1416
1417       Applicable socket types   ZMQ_XPUB
1418
1419
1420   ZMQ_XPUB_VERBOSER: pass duplicate subscribe and unsubscribe messages on
1421       XPUB socket
1422       Sets the XPUB socket behaviour on new duplicated subscriptions and
1423       unsubscriptions. If enabled, the socket passes all subscribe and
1424       unsubscribe messages to the caller. If disabled, only the first
1425       subscription to each filter and the last unsubscription from each
1426       filter will be passed. The default is 0 (disabled).
1427
1428
1429       Option value type         int
1430
1431       Option value unit         0, 1
1432
1433       Default value             0
1434
1435       Applicable socket types   ZMQ_XPUB
1436
1437
1438   ZMQ_XPUB_MANUAL: change the subscription handling to manual
1439       Sets the XPUB socket subscription handling mode manual/automatic. A
1440       value of 0 is the default and subscription requests will be handled
1441       automatically. A value of 1 will change the subscription requests
1442       handling to manual, with manual mode subscription requests are not
1443       added to the subscription list. To add subscription the user need to
1444       call setsockopt with ZMQ_SUBSCRIBE on XPUB socket.
1445
1446
1447       Option value type         int
1448
1449       Option value unit         0, 1
1450
1451       Default value             0
1452
1453       Applicable socket types   ZMQ_XPUB
1454
1455
1456   ZMQ_XPUB_MANUAL_LAST_VALUE: change the subscription handling to manual
1457       This option is similar to ZMQ_XPUB_MANUAL. The difference is that
1458       ZMQ_XPUB_MANUAL_LAST_VALUE changes the XPUB socket behaviour to send
1459       the first message to the last subscriber after the socket receives a
1460       subscription and call setsockopt with ZMQ_SUBSCRIBE on XPUB socket.
1461       This prevents duplicated messages when using last value caching(LVC).
1462
1463           Note
1464           in DRAFT state, not yet available in stable releases.
1465
1466
1467       Option value type         int
1468
1469
1470
1471       Option value unit         0, 1
1472
1473       Default value             0
1474
1475       Applicable socket types   ZMQ_XPUB
1476
1477
1478   ZMQ_XPUB_NODROP: do not silently drop messages if SENDHWM is reached
1479       Sets the XPUB socket behaviour to return error EAGAIN if SENDHWM is
1480       reached and the message could not be send.
1481
1482       A value of 0 is the default and drops the message silently when the
1483       peers SNDHWM is reached. A value of 1 returns an EAGAIN error code if
1484       the SNDHWM is reached and ZMQ_DONTWAIT was used.
1485
1486
1487       Option value type         int
1488
1489       Option value unit         0, 1
1490
1491       Default value             0
1492
1493       Applicable socket types   ZMQ_XPUB, ZMQ_PUB
1494
1495
1496   ZMQ_XPUB_WELCOME_MSG: set welcome message that will be received by
1497       subscriber when connecting
1498       Sets a welcome message the will be recieved by subscriber when
1499       connecting. Subscriber must subscribe to the Welcome message before
1500       connecting. Welcome message will also be sent on reconnecting. For
1501       welcome message to work well user must poll on incoming subscription
1502       messages on the XPUB socket and handle them.
1503
1504       Use NULL and length of zero to disable welcome message.
1505
1506
1507       Option value type         binary data
1508
1509       Option value unit         N/A
1510
1511       Default value             NULL
1512
1513       Applicable socket types   ZMQ_XPUB
1514
1515
1516   ZMQ_ONLY_FIRST_SUBSCRIBE: Process only first subscribe/unsubscribe in a
1517       multipart message
1518       If set, only the first part of the multipart message is processed as a
1519       subscribe/unsubscribe message. The rest are forwarded as user data
1520       regardless of message contents.
1521
1522       It not set (default), subscribe/unsubscribe messages in a multipart
1523       message are processed as such regardless of their number and order.
1524
1525
1526       Option value type         int
1527
1528       Option value unit         boolean
1529
1530       Default value             0 (false)
1531
1532       Applicable socket types   ZMQ_XSUB, ZMQ_XPUB
1533
1534
1535   ZMQ_ZAP_DOMAIN: Set RFC 27 authentication domain
1536       Sets the domain for ZAP (ZMQ RFC 27) authentication. A ZAP domain must
1537       be specified to enable authentication. When the ZAP domain is empty,
1538       which is the default, ZAP authentication is disabled. This is not
1539       compatible with previous versions of libzmq, so it can be controlled by
1540       ZMQ_ZAP_ENFORCE_DOMAIN which for now is disabled by default. See
1541       http://rfc.zeromq.org/spec:27 for more details.
1542
1543
1544       Option value type         character string
1545
1546       Option value unit         N/A
1547
1548       Default value             empty
1549
1550       Applicable socket types   all, when using TCP
1551                                 transport
1552
1553
1554   ZMQ_ZAP_ENFORCE_DOMAIN: Set ZAP domain handling to strictly adhere the RFC
1555       The ZAP (ZMQ RFC 27) authentication protocol specifies that a domain
1556       must always be set. Older versions of libzmq did not follow the spec
1557       and allowed an empty domain to be set. This option can be used to
1558       enabled or disable the stricter, backward incompatible behaviour. For
1559       now it is disabled by default, but in a future version it will be
1560       enabled by default.
1561
1562
1563       Option value type         int
1564
1565       Option value unit         0, 1
1566
1567       Default value             0
1568
1569       Applicable socket types   all, when using ZAP
1570
1571
1572   ZMQ_TCP_ACCEPT_FILTER: Assign filters to allow new TCP connections
1573       Assign an arbitrary number of filters that will be applied for each new
1574       TCP transport connection on a listening socket. If no filters are
1575       applied, then the TCP transport allows connections from any IP address.
1576       If at least one filter is applied then new connection source ip should
1577       be matched. To clear all filters call zmq_setsockopt(socket,
1578       ZMQ_TCP_ACCEPT_FILTER, NULL, 0). Filter is a null-terminated string
1579       with ipv6 or ipv4 CIDR.
1580
1581           Note
1582           This option is deprecated, please use authentication via the ZAP
1583           API and IP address allowing / blocking.
1584
1585
1586       Option value type         binary data
1587
1588       Option value unit         N/A
1589
1590       Default value             no filters (allow from
1591                                 all)
1592
1593       Applicable socket types   all listening sockets,
1594                                 when using TCP transports.
1595
1596
1597   ZMQ_IPC_FILTER_GID: Assign group ID filters to allow new IPC connections
1598       Assign an arbitrary number of filters that will be applied for each new
1599       IPC transport connection on a listening socket. If no IPC filters are
1600       applied, then the IPC transport allows connections from any process. If
1601       at least one UID, GID, or PID filter is applied then new connection
1602       credentials should be matched. To clear all GID filters call
1603       zmq_setsockopt(socket, ZMQ_IPC_FILTER_GID, NULL, 0).
1604
1605           Note
1606           GID filters are only available on platforms supporting SO_PEERCRED
1607           or LOCAL_PEERCRED socket options (currently only Linux and later
1608           versions of OS X).
1609
1610           Note
1611           This option is deprecated, please use authentication via the ZAP
1612           API and IPC allowing / blocking.
1613
1614
1615       Option value type         gid_t
1616
1617       Option value unit         N/A
1618
1619       Default value             no filters (allow from
1620                                 all)
1621
1622       Applicable socket types   all listening sockets,
1623                                 when using IPC transports.
1624
1625
1626   ZMQ_IPC_FILTER_PID: Assign process ID filters to allow new IPC connections
1627       Assign an arbitrary number of filters that will be applied for each new
1628       IPC transport connection on a listening socket. If no IPC filters are
1629       applied, then the IPC transport allows connections from any process. If
1630       at least one UID, GID, or PID filter is applied then new connection
1631       credentials should be matched. To clear all PID filters call
1632       zmq_setsockopt(socket, ZMQ_IPC_FILTER_PID, NULL, 0).
1633
1634           Note
1635           PID filters are only available on platforms supporting the
1636           SO_PEERCRED socket option (currently only Linux).
1637
1638           Note
1639           This option is deprecated, please use authentication via the ZAP
1640           API and IPC allowing / blocking.
1641
1642
1643       Option value type         pid_t
1644
1645       Option value unit         N/A
1646
1647       Default value             no filters (allow from
1648                                 all)
1649
1650       Applicable socket types   all listening sockets,
1651                                 when using IPC transports.
1652
1653
1654   ZMQ_IPC_FILTER_UID: Assign user ID filters to allow new IPC connections
1655       Assign an arbitrary number of filters that will be applied for each new
1656       IPC transport connection on a listening socket. If no IPC filters are
1657       applied, then the IPC transport allows connections from any process. If
1658       at least one UID, GID, or PID filter is applied then new connection
1659       credentials should be matched. To clear all UID filters call
1660       zmq_setsockopt(socket, ZMQ_IPC_FILTER_UID, NULL, 0).
1661
1662           Note
1663           UID filters are only available on platforms supporting SO_PEERCRED
1664           or LOCAL_PEERCRED socket options (currently only Linux and later
1665           versions of OS X).
1666
1667           Note
1668           This option is deprecated, please use authentication via the ZAP
1669           API and IPC allowing / blocking.
1670
1671
1672       Option value type         uid_t
1673
1674
1675       Option value unit         N/A
1676
1677       Default value             no filters (allow from
1678                                 all)
1679
1680       Applicable socket types   all listening sockets,
1681                                 when using IPC transports.
1682
1683
1684   ZMQ_IPV4ONLY: Use IPv4-only on socket
1685       Set the IPv4-only option for the socket. This option is deprecated.
1686       Please use the ZMQ_IPV6 option.
1687
1688
1689       Option value type         int
1690
1691       Option value unit         boolean
1692
1693       Default value             1 (true)
1694
1695       Applicable socket types   all, when using TCP
1696                                 transports.
1697
1698
1699   ZMQ_VMCI_BUFFER_SIZE: Set buffer size of the VMCI socket
1700       The ZMQ_VMCI_BUFFER_SIZE option shall set the size of the underlying
1701       buffer for the socket. Used during negotiation before the connection is
1702       established.
1703
1704
1705       Option value type         uint64_t
1706
1707       Option value unit         bytes
1708
1709       Default value             65546
1710
1711       Applicable socket types   all, when using VMCI
1712                                 transport
1713
1714
1715   ZMQ_VMCI_BUFFER_MIN_SIZE: Set min buffer size of the VMCI socket
1716       The ZMQ_VMCI_BUFFER_MIN_SIZE option shall set the min size of the
1717       underlying buffer for the socket. Used during negotiation before the
1718       connection is established.
1719
1720
1721       Option value type         uint64_t
1722
1723       Option value unit         bytes
1724
1725       Default value             128
1726
1727       Applicable socket types   all, when using VMCI
1728                                 transport
1729
1730
1731   ZMQ_VMCI_BUFFER_MAX_SIZE: Set max buffer size of the VMCI socket
1732       The ZMQ_VMCI_BUFFER_MAX_SIZE option shall set the max size of the
1733       underlying buffer for the socket. Used during negotiation before the
1734       connection is established.
1735
1736
1737       Option value type         uint64_t
1738
1739       Option value unit         bytes
1740
1741
1742
1743       Default value             262144
1744
1745       Applicable socket types   all, when using VMCI
1746                                 transport
1747
1748
1749   ZMQ_VMCI_CONNECT_TIMEOUT: Set connection timeout of the VMCI socket
1750       The ZMQ_VMCI_CONNECT_TIMEOUT option shall set connection timeout for
1751       the socket.
1752
1753
1754       Option value type         int
1755
1756       Option value unit         milliseconds
1757
1758       Default value             -1
1759
1760       Applicable socket types   all, when using VMCI
1761                                 transport
1762
1763
1764   ZMQ_MULTICAST_LOOP: Control multicast local loopback
1765       For multicast UDP sender sockets this option sets whether the data sent
1766       should be looped back on local listening sockets.
1767
1768
1769       Option value type         int
1770
1771       Option value unit         0, 1
1772
1773       Default value             1
1774
1775       Applicable socket types   ZMQ_RADIO, when using UDP
1776                                 multicast transport
1777
1778
1779   ZMQ_ROUTER_NOTIFY: Send connect and disconnect notifications
1780       Enable connect and disconnect notifications on a ROUTER socket. When
1781       enabled, the socket delivers a zero-length message (with routing-id as
1782       first frame) when a peer connects or disconnects. It’s possible to
1783       notify both events for a peer by OR-ing the flag values. This option
1784       only applies to stream oriented (tcp, ipc) transports.
1785
1786           Note
1787           in DRAFT state, not yet available in stable releases.
1788
1789
1790       Option value type         int
1791
1792       Option value unit         0, ZMQ_NOTIFY_CONNECT,
1793                                 ZMQ_NOTIFY_DISCONNECT,
1794                                 ZMQ_NOTIFY_CONNECT |
1795                                 ZMQ_NOTIFY_DISCONNECT
1796
1797       Default value             0
1798
1799       Applicable socket types   ZMQ_ROUTER
1800
1801
1802   ZMQ_IN_BATCH_SIZE: Maximal receive batch size
1803       Sets the maximal amount of messages that can be received in a single
1804       recv system call. WARNING: this option should almost never be changed.
1805       The default has been chosen to offer the best compromise between
1806       latency and throughtput. In the vast majority of cases, changing this
1807       option will result in worst result if not outright breakages.
1808
1809       Cannot be zero.
1810
1811           Note
1812           in DRAFT state, not yet available in stable releases.
1813
1814
1815       Option value type         int
1816
1817       Option value unit         messages
1818
1819       Default value             8192
1820
1821       Applicable socket types   All, when using TCP, IPC,
1822                                 PGM or NORM transport.
1823
1824
1825   ZMQ_OUT_BATCH_SIZE: Maximal send batch size
1826       Sets the maximal amount of messages that can be sent in a single send
1827       system call. WARNING: this option should almost never be changed. The
1828       default has been chosen to offer the best compromise between latency
1829       and throughtput. In the vast majority of cases, changing this option
1830       will result in worst result if not outright breakages.
1831
1832       Cannot be zero.
1833
1834           Note
1835           in DRAFT state, not yet available in stable releases.
1836
1837
1838       Option value type         int
1839
1840       Option value unit         messages
1841
1842       Default value             8192
1843
1844       Applicable socket types   All, when using TCP, IPC,
1845                                 PGM or NORM transport.
1846
1847

RETURN VALUE

1849       The zmq_setsockopt() function shall return zero if successful.
1850       Otherwise it shall return -1 and set errno to one of the values defined
1851       below.
1852

ERRORS

1854       EINVAL
1855           The requested option option_name is unknown, or the requested
1856           option_len or option_value is invalid.
1857
1858       ETERM
1859           The 0MQ context associated with the specified socket was
1860           terminated.
1861
1862       ENOTSOCK
1863           The provided socket was invalid.
1864
1865       EINTR
1866           The operation was interrupted by delivery of a signal.
1867

EXAMPLE

1869       Subscribing to messages on a ZMQ_SUB socket.
1870
1871           /* Subscribe to all messages */
1872           rc = zmq_setsockopt (socket, ZMQ_SUBSCRIBE, "", 0);
1873           assert (rc == 0);
1874           /* Subscribe to messages prefixed with "ANIMALS.CATS" */
1875           rc = zmq_setsockopt (socket, ZMQ_SUBSCRIBE, "ANIMALS.CATS", 12);
1876
1877       Setting I/O thread affinity.
1878
1879           int64_t affinity;
1880           /* Incoming connections on TCP port 5555 shall be handled by I/O thread 1 */
1881           affinity = 1;
1882           rc = zmq_setsockopt (socket, ZMQ_AFFINITY, &affinity, sizeof (affinity));
1883           assert (rc);
1884           rc = zmq_bind (socket, "tcp://lo:5555");
1885           assert (rc);
1886           /* Incoming connections on TCP port 5556 shall be handled by I/O thread 2 */
1887           affinity = 2;
1888           rc = zmq_setsockopt (socket, ZMQ_AFFINITY, &affinity, sizeof (affinity));
1889           assert (rc);
1890           rc = zmq_bind (socket, "tcp://lo:5556");
1891           assert (rc);
1892
1893

SEE ALSO

1895       zmq_getsockopt(3) zmq_socket(3) zmq_plain(7) zmq_curve(7) zmq(7)
1896

AUTHORS

1898       This page was written by the 0MQ community. To make a change please
1899       read the 0MQ Contribution Policy at
1900       http://www.zeromq.org/docs:contributing.
1901
1902
1903
19040MQ 4.3.4                         07/23/2022                 ZMQ_SETSOCKOPT(3)
Impressum