1ZMQ_GETSOCKOPT(3) 0MQ Manual ZMQ_GETSOCKOPT(3)
2
3
4
6 zmq_getsockopt - get 0MQ socket options
7
9 int zmq_getsockopt (void *socket, int option_name, void *option_value,
10 size_t *option_len);
11
13 The zmq_getsockopt() function shall retrieve the value for the option
14 specified by the option_name argument for the 0MQ socket pointed to by
15 the socket argument, and store it in the buffer pointed to by the
16 option_value argument. The option_len argument is the size in bytes of
17 the buffer pointed to by option_value; upon successful completion
18 zmq_getsockopt() shall modify the option_len argument to indicate the
19 actual size of the option value stored in the buffer.
20
21 The following options can be retrieved with the zmq_getsockopt()
22 function:
23
24 ZMQ_AFFINITY: Retrieve I/O thread affinity
25 The ZMQ_AFFINITY option shall retrieve the I/O thread affinity for
26 newly created connections on the specified socket.
27
28 Affinity determines which threads from the 0MQ I/O thread pool
29 associated with the socket’s context shall handle newly created
30 connections. A value of zero specifies no affinity, meaning that work
31 shall be distributed fairly among all 0MQ I/O threads in the thread
32 pool. For non-zero values, the lowest bit corresponds to thread 1,
33 second lowest bit to thread 2 and so on. For example, a value of 3
34 specifies that subsequent connections on socket shall be handled
35 exclusively by I/O threads 1 and 2.
36
37 See also zmq_init(3) for details on allocating the number of I/O
38 threads for a specific context.
39
40
41 Option value type uint64_t
42
43 Option value unit N/A (bitmap)
44
45 Default value 0
46
47 Applicable socket types N/A
48
49
50 ZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding
51 connections
52 The ZMQ_BACKLOG option shall retrieve the maximum length of the queue
53 of outstanding peer connections for the specified socket; this only
54 applies to connection-oriented transports. For details refer to your
55 operating system documentation for the listen function.
56
57
58 Option value type int
59
60 Option value unit connections
61
62 Default value 100
63
64
65
66
67
68 Applicable socket types all, only for
69 connection-oriented
70 transports
71
72
73 ZMQ_BINDTODEVICE: Retrieve name of device the socket is bound to
74 The ZMQ_BINDTODEVICE option retrieves the name of the device this
75 socket is bound to, eg. an interface or VRF. If a socket is bound to an
76 interface, only packets received from that interface are processed by
77 the socket. If device is a VRF device, then subsequent binds/connects
78 to that socket use addresses in the VRF routing table.
79
80
81 Option value type character string
82
83 Option value unit N/A
84
85 Default value not set
86
87 Applicable socket types all, when using TCP or UDP
88 transports.
89
90
91 ZMQ_CONNECT_TIMEOUT: Retrieve connect() timeout
92 Retrieves how long to wait before timing-out a connect() system call.
93 The connect() system call normally takes a long time before it returns
94 a time out error. Setting this option allows the library to time out
95 the call at an earlier interval.
96
97
98 Option value type int
99
100 Option value unit milliseconds
101
102 Default value 0 (disabled)
103
104 Applicable socket types all, when using TCP
105 transports.
106
107
108 ZMQ_CURVE_PUBLICKEY: Retrieve current CURVE public key
109 Retrieves the current long term public key for the socket. You can
110 provide either a 32 byte buffer, to retrieve the binary key value, or a
111 41 byte buffer, to retrieve the key in a printable Z85 format. NOTE: to
112 fetch a printable key, the buffer must be 41 bytes large to hold the
113 40-char key value and one null byte.
114
115
116 Option value type binary data or Z85 text
117 string
118
119 Option value size 32 or 41
120
121 Default value null
122
123 Applicable socket types all, when using TCP
124 transport
125
126
127 ZMQ_CURVE_SECRETKEY: Retrieve current CURVE secret key
128 Retrieves the current long term secret key for the socket. You can
129 provide either a 32 byte buffer, to retrieve the binary key value, or a
130 41 byte buffer, to retrieve the key in a printable Z85 format. NOTE: to
131 fetch a printable key, the buffer must be 41 bytes large to hold the
132 40-char key value and one null byte.
133
134
135 Option value type binary data or Z85 text
136 string
137
138 Option value size 32 or 41
139
140 Default value null
141
142 Applicable socket types all, when using TCP
143 transport
144
145
146 ZMQ_CURVE_SERVERKEY: Retrieve current CURVE server key
147 Retrieves the current server key for the client socket. You can provide
148 either a 32 byte buffer, to retrieve the binary key value, or a 41-byte
149 buffer, to retrieve the key in a printable Z85 format. NOTE: to fetch a
150 printable key, the buffer must be 41 bytes large to hold the 40-char
151 key value and one null byte.
152
153
154 Option value type binary data or Z85 text
155 string
156
157 Option value size 32 or 41
158
159 Default value null
160
161 Applicable socket types all, when using TCP
162 transport
163
164
165 ZMQ_EVENTS: Retrieve socket event state
166 The ZMQ_EVENTS option shall retrieve the event state for the specified
167 socket. The returned value is a bit mask constructed by OR’ing a
168 combination of the following event flags:
169
170 ZMQ_POLLIN
171 Indicates that at least one message may be received from the
172 specified socket without blocking.
173
174 ZMQ_POLLOUT
175 Indicates that at least one message may be sent to the specified
176 socket without blocking.
177
178 The combination of a file descriptor returned by the ZMQ_FD option
179 being ready for reading but no actual events returned by a subsequent
180 retrieval of the ZMQ_EVENTS option is valid; applications should simply
181 ignore this case and restart their polling operation/event loop.
182
183
184 Option value type int
185
186 Option value unit N/A (flags)
187
188 Default value N/A
189
190 Applicable socket types all
191
192
193 ZMQ_FD: Retrieve file descriptor associated with the socket
194 The ZMQ_FD option shall retrieve the file descriptor associated with
195 the specified socket. The returned file descriptor can be used to
196 integrate the socket into an existing event loop; the 0MQ library shall
197 signal any pending events on the socket in an edge-triggered fashion by
198 making the file descriptor become ready for reading.
199
200 Note
201 The ability to read from the returned file descriptor does not
202 necessarily indicate that messages are available to be read from,
203 or can be written to, the underlying socket; applications must
204 retrieve the actual event state with a subsequent retrieval of the
205 ZMQ_EVENTS option.
206
207 Note
208 The returned file descriptor is also used internally by the
209 zmq_send and zmq_recv functions. As the descriptor is edge
210 triggered, applications must update the state of ZMQ_EVENTS after
211 each invocation of zmq_send or zmq_recv.To be more explicit: after
212 calling zmq_send the socket may become readable (and vice versa)
213 without triggering a read event on the file descriptor.
214
215 Caution
216 The returned file descriptor is intended for use with a poll or
217 similar system call only. Applications must never attempt to read
218 or write data to it directly, neither should they try to close it.
219
220
221 Option value type int on POSIX systems,
222 SOCKET on Windows
223
224 Option value unit N/A
225
226 Default value N/A
227
228 Applicable socket types all
229
230
231 ZMQ_GSSAPI_PLAINTEXT: Retrieve GSSAPI plaintext or encrypted status
232 Returns the ZMQ_GSSAPI_PLAINTEXT option, if any, previously set on the
233 socket. A value of 1 means that communications will be plaintext. A
234 value of 0 means communications will be encrypted.
235
236
237 Option value type int
238
239 Option value unit 0, 1
240
241 Default value 0 (false)
242
243 Applicable socket types all, when using TCP or IPC
244 transports
245
246
247 ZMQ_GSSAPI_PRINCIPAL: Retrieve the name of the GSSAPI principal
248 The ZMQ_GSSAPI_PRINCIPAL option shall retrieve the principal name set
249 for the GSSAPI security mechanism. The returned value shall be a
250 NULL-terminated string and MAY be empty. The returned size SHALL
251 include the terminating null byte.
252
253
254 Option value type NULL-terminated character
255 string
256
257 Option value unit N/A
258
259 Default value null string
260
261 Applicable socket types all, when using TCP or IPC
262 transports
263
264
265 ZMQ_GSSAPI_SERVER: Retrieve current GSSAPI server role
266 Returns the ZMQ_GSSAPI_SERVER option, if any, previously set on the
267 socket.
268
269
270 Option value type int
271
272 Option value unit 0, 1
273
274 Default value 0 (false)
275
276 Applicable socket types all, when using TCP or IPC
277 transports
278
279
280 ZMQ_GSSAPI_SERVICE_PRINCIPAL: Retrieve the name of the GSSAPI service
281 principal
282 The ZMQ_GSSAPI_SERVICE_PRINCIPAL option shall retrieve the principal
283 name of the GSSAPI server to which a GSSAPI client socket intends to
284 connect. The returned value shall be a NULL-terminated string and MAY
285 be empty. The returned size SHALL include the terminating null byte.
286
287
288 Option value type NULL-terminated character
289 string
290
291 Option value unit N/A
292
293 Default value null string
294
295 Applicable socket types all, when using TCP or IPC
296 transports
297
298
299 ZMQ_GSSAPI_SERVICE_PRINCIPAL_NAMETYPE: Retrieve nametype for service
300 principal
301 Returns the ZMQ_GSSAPI_SERVICE_PRINCIPAL_NAMETYPE option, if any,
302 previously set on the socket. A value of ZMQ_GSSAPI_NT_HOSTBASED (0)
303 means the name specified with ZMQ_GSSAPI_SERVICE_PRINCIPAL is
304 interpreted as a host based name. A value of ZMQ_GSSAPI_NT_USER_NAME
305 (1) means it is interpreted as a local user name. A value of
306 ZMQ_GSSAPI_NT_KRB5_PRINCIPAL (2) means it is interpreted as an unparsed
307 principal name string (valid only with the krb5 GSSAPI mechanism).
308
309
310 Option value type int
311
312 Option value unit 0, 1, 2
313
314 Default value 0
315 (ZMQ_GSSAPI_NT_HOSTBASED)
316
317 Applicable socket types all, when using TCP or IPC
318 transports
319
320
321 ZMQ_GSSAPI_PRINCIPAL_NAMETYPE: Retrieve nametype for service principal
322 Returns the ZMQ_GSSAPI_PRINCIPAL_NAMETYPE option, if any, previously
323 set on the socket. A value of ZMQ_GSSAPI_NT_HOSTBASED (0) means the
324 name specified with ZMQ_GSSAPI_PRINCIPAL is interpreted as a host based
325 name. A value of ZMQ_GSSAPI_NT_USER_NAME (1) means it is interpreted as
326 a local user name. A value of ZMQ_GSSAPI_NT_KRB5_PRINCIPAL (2) means it
327 is interpreted as an unparsed principal name string (valid only with
328 the krb5 GSSAPI mechanism).
329
330
331
332 Option value type int
333
334 Option value unit 0, 1, 2
335
336 Default value 0
337 (ZMQ_GSSAPI_NT_HOSTBASED)
338
339 Applicable socket types all, when using TCP or IPC
340 transports
341
342
343 ZMQ_HANDSHAKE_IVL: Retrieve maximum handshake interval
344 The ZMQ_HANDSHAKE_IVL option shall retrieve the maximum handshake
345 interval for the specified socket. Handshaking is the exchange of
346 socket configuration information (socket type, routing id, security)
347 that occurs when a connection is first opened, only for
348 connection-oriented transports. If handshaking does not complete within
349 the configured time, the connection shall be closed. The value 0 means
350 no handshake time limit.
351
352
353 Option value type int
354
355 Option value unit milliseconds
356
357 Default value 30000
358
359 Applicable socket types all but ZMQ_STREAM, only
360 for connection-oriented
361 transports
362
363
364 ZMQ_IDENTITY: Retrieve socket identity
365 This option name is now deprecated. Use ZMQ_ROUTING_ID instead.
366 ZMQ_IDENTITY remains as an alias for now.
367
368 ZMQ_IMMEDIATE: Retrieve attach-on-connect value
369 Retrieve the state of the attach on connect value. If set to 1, will
370 delay the attachment of a pipe on connect until the underlying
371 connection has completed. This will cause the socket to block if there
372 are no other connections, but will prevent queues from filling on pipes
373 awaiting connection.
374
375
376 Option value type int
377
378 Option value unit boolean
379
380 Default value 0 (false)
381
382 Applicable socket types all, primarily when using
383 TCP/IPC transports.
384
385
386 ZMQ_INVERT_MATCHING: Retrieve inverted filtering status
387 Returns the value of the ZMQ_INVERT_MATCHING option. A value of 1 means
388 the socket uses inverted prefix matching.
389
390 On PUB and XPUB sockets, this causes messages to be sent to all
391 connected sockets except those subscribed to a prefix that matches the
392 message. On SUB sockets, this causes only incoming messages that do not
393 match any of the socket’s subscriptions to be received by the user.
394
395 Whenever ZMQ_INVERT_MATCHING is set to 1 on a PUB socket, all SUB
396 sockets connecting to it must also have the option set to 1. Failure to
397 do so will have the SUB sockets reject everything the PUB socket sends
398 them. XSUB sockets do not need to do this because they do not filter
399 incoming messages.
400
401
402 Option value type int
403
404 Option value unit 0,1
405
406 Default value 0
407
408 Applicable socket types ZMQ_PUB, ZMQ_XPUB, ZMQ_SUB
409
410
411 ZMQ_IPV4ONLY: Retrieve IPv4-only socket override status
412 Retrieve the IPv4-only option for the socket. This option is
413 deprecated. Please use the ZMQ_IPV6 option.
414
415
416 Option value type int
417
418 Option value unit boolean
419
420 Default value 1 (true)
421
422 Applicable socket types all, when using TCP
423 transports.
424
425
426 ZMQ_IPV6: Retrieve IPv6 socket status
427 Retrieve the IPv6 option for the socket. A value of 1 means IPv6 is
428 enabled on the socket, while 0 means the socket will use only IPv4.
429 When IPv6 is enabled the socket will connect to, or accept connections
430 from, both IPv4 and IPv6 hosts.
431
432
433 Option value type int
434
435 Option value unit boolean
436
437 Default value 0 (false)
438
439 Applicable socket types all, when using TCP
440 transports.
441
442
443 ZMQ_LAST_ENDPOINT: Retrieve the last endpoint set
444 The ZMQ_LAST_ENDPOINT option shall retrieve the last endpoint bound for
445 TCP and IPC transports. The returned value will be a string in the form
446 of a ZMQ DSN. Note that if the TCP host is INADDR_ANY, indicated by a
447 *, then the returned address will be 0.0.0.0 (for IPv4). Note: not
448 supported on GNU/Hurd with IPC due to non-working getsockname().
449
450
451 Option value type NULL-terminated character
452 string
453
454 Option value unit N/A
455
456 Default value NULL
457
458 Applicable socket types all, when binding TCP or
459 IPC transports
460
461
462 ZMQ_LINGER: Retrieve linger period for socket shutdown
463 The ZMQ_LINGER option shall retrieve the linger period for the
464 specified socket. The linger period determines how long pending
465 messages which have yet to be sent to a peer shall linger in memory
466 after a socket is closed with zmq_close(3), and further affects the
467 termination of the socket’s context with zmq_ctx_term(3). The following
468 outlines the different behaviours:
469
470 • The default value of -1 specifies an infinite linger period.
471 Pending messages shall not be discarded after a call to
472 zmq_close(); attempting to terminate the socket’s context with
473 zmq_ctx_term() shall block until all pending messages have been
474 sent to a peer.
475
476 • The value of 0 specifies no linger period. Pending messages shall
477 be discarded immediately when the socket is closed with
478 zmq_close().
479
480 • Positive values specify an upper bound for the linger period in
481 milliseconds. Pending messages shall not be discarded after a call
482 to zmq_close(); attempting to terminate the socket’s context with
483 zmq_ctx_term() shall block until either all pending messages have
484 been sent to a peer, or the linger period expires, after which any
485 pending messages shall be discarded.
486
487 Option value type int
488 Option value unit milliseconds
489 Default value -1 (infinite)
490 Applicable socket types all
491
492
493 ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size
494 The option shall retrieve limit for the inbound messages. If a peer
495 sends a message larger than ZMQ_MAXMSGSIZE it is disconnected. Value of
496 -1 means no limit.
497
498
499 Option value type int64_t
500
501 Option value unit bytes
502
503 Default value -1
504
505 Applicable socket types all
506
507
508 ZMQ_MECHANISM: Retrieve current security mechanism
509 The ZMQ_MECHANISM option shall retrieve the current security mechanism
510 for the socket.
511
512
513 Option value type int
514
515 Option value unit ZMQ_NULL, ZMQ_PLAIN,
516 ZMQ_CURVE, or ZMQ_GSSAPI
517
518 Default value ZMQ_NULL
519
520 Applicable socket types all, when using TCP or IPC
521 transports
522
523
524 ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets
525 The option shall retrieve time-to-live used for outbound multicast
526 packets. The default of 1 means that the multicast packets don’t leave
527 the local network.
528
529
530 Option value type int
531
532
533
534 Option value unit network hops
535
536 Default value 1
537
538 Applicable socket types all, when using multicast
539 transports
540
541
542 ZMQ_MULTICAST_MAXTPDU: Maximum transport data unit size for multicast
543 packets
544 The ZMQ_MULTICAST_MAXTPDU option shall retrieve the maximum transport
545 data unit size used for outbound multicast packets.
546
547 This must be set at or below the minimum Maximum Transmission Unit
548 (MTU) for all network paths over which multicast reception is required.
549
550
551 Option value type int
552
553 Option value unit bytes
554
555 Default value 1500
556
557 Applicable socket types all, when using multicast
558 transports
559
560
561 ZMQ_PLAIN_PASSWORD: Retrieve current password
562 The ZMQ_PLAIN_PASSWORD option shall retrieve the last password set for
563 the PLAIN security mechanism. The returned value shall be a
564 NULL-terminated string and MAY be empty. The returned size SHALL
565 include the terminating null byte.
566
567
568 Option value type NULL-terminated character
569 string
570
571 Option value unit N/A
572
573 Default value null string
574
575 Applicable socket types all, when using TCP or IPC
576 transports
577
578
579 ZMQ_PLAIN_SERVER: Retrieve current PLAIN server role
580 Returns the ZMQ_PLAIN_SERVER option, if any, previously set on the
581 socket.
582
583
584 Option value type int
585
586 Option value unit 0, 1
587
588 Default value int
589
590 Applicable socket types all, when using TCP or IPC
591 transports
592
593
594 ZMQ_PLAIN_USERNAME: Retrieve current PLAIN username
595 The ZMQ_PLAIN_USERNAME option shall retrieve the last username set for
596 the PLAIN security mechanism. The returned value shall be a
597 NULL-terminated string and MAY be empty. The returned size SHALL
598 include the terminating null byte.
599
600
601
602 Option value type NULL-terminated character
603 string
604
605 Option value unit N/A
606
607 Default value null string
608
609 Applicable socket types all, when using TCP or IPC
610 transports
611
612
613 ZMQ_USE_FD: Retrieve the pre-allocated socket file descriptor
614 The ZMQ_USE_FD option shall retrieve the pre-allocated file descriptor
615 that has been assigned to a ZMQ socket, if any. -1 shall be returned if
616 a pre-allocated file descriptor was not set for the socket.
617
618
619 Option value type int
620
621 Option value unit file descriptor
622
623 Default value -1
624
625 Applicable socket types all bound sockets, when
626 using IPC or TCP transport
627
628
629 ZMQ_PRIORITY: Retrieve the Priority on socket
630
631 Gets the protocol-defined priority for all packets to be sent on this
632 socket, where supported by the OS.
633
634 [horizontal]
635 Option value type:: int
636 Option value unit:: >0
637 Default value:: 0
638 Applicable socket types:: all, only for connection-oriented transports
639
640
641 ZMQ_RATE: Retrieve multicast data rate
642
643 The ZMQ_RATE option shall retrieve the maximum send or receive data
644 rate for multicast transports using the specified socket.
645
646
647 Option value type int
648
649 Option value unit kilobits per second
650
651 Default value 100
652
653 Applicable socket types all, when using multicast
654 transports
655
656
657 ZMQ_RCVBUF: Retrieve kernel receive buffer size
658 The ZMQ_RCVBUF option shall retrieve the underlying kernel receive
659 buffer size for the specified socket. For details refer to your
660 operating system documentation for the SO_RCVBUF socket option.
661
662
663 Option value type int
664
665 Option value unit bytes
666
667 Default value 8192
668
669
670 Applicable socket types all
671
672
673 ZMQ_RCVHWM: Retrieve high water mark for inbound messages
674 The ZMQ_RCVHWM option shall return the high water mark for inbound
675 messages on the specified socket. The high water mark is a hard limit
676 on the maximum number of outstanding messages 0MQ shall queue in memory
677 for any single peer that the specified socket is communicating with. A
678 value of zero means no limit.
679
680 If this limit has been reached the socket shall enter an exceptional
681 state and depending on the socket type, 0MQ shall take appropriate
682 action such as blocking or dropping sent messages. Refer to the
683 individual socket descriptions in zmq_socket(3) for details on the
684 exact action taken for each socket type.
685
686
687 Option value type int
688
689 Option value unit messages
690
691 Default value 1000
692
693 Applicable socket types all
694
695
696 ZMQ_RCVMORE: More message data parts to follow
697 The ZMQ_RCVMORE option shall return True (1) if the message part last
698 received from the socket was a data part with more parts to follow. If
699 there are no data parts to follow, this option shall return False (0).
700
701 Refer to zmq_send(3) and zmq_recv(3) for a detailed description of
702 multi-part messages.
703
704
705 Option value type int
706
707 Option value unit boolean
708
709 Default value N/A
710
711 Applicable socket types all
712
713
714 ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN
715 Retrieve the timeout for recv operation on the socket. If the value is
716 0, zmq_recv(3) will return immediately, with a EAGAIN error if there is
717 no message to receive. If the value is -1, it will block until a
718 message is available. For all other values, it will wait for a message
719 for that amount of time before returning with an EAGAIN error.
720
721
722 Option value type int
723
724 Option value unit milliseconds
725
726 Default value -1 (infinite)
727
728 Applicable socket types all
729
730
731 ZMQ_RECONNECT_IVL: Retrieve reconnection interval
732 The ZMQ_RECONNECT_IVL option shall retrieve the initial reconnection
733 interval for the specified socket. The reconnection interval is the
734 period 0MQ shall wait between attempts to reconnect disconnected peers
735 when using connection-oriented transports. The value -1 means no
736 reconnection.
737
738 Note
739 The reconnection interval may be randomized by 0MQ to prevent
740 reconnection storms in topologies with a large number of peers per
741 socket.
742
743
744 Option value type int
745
746 Option value unit milliseconds
747
748 Default value 100
749
750 Applicable socket types all, only for
751 connection-oriented
752 transports
753
754
755 ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval
756 The ZMQ_RECONNECT_IVL_MAX option shall retrieve the maximum
757 reconnection interval for the specified socket. This is the maximum
758 period 0MQ shall wait between attempts to reconnect. On each reconnect
759 attempt, the previous interval shall be doubled untill
760 ZMQ_RECONNECT_IVL_MAX is reached. This allows for exponential backoff
761 strategy. Default value means no exponential backoff is performed and
762 reconnect interval calculations are only based on ZMQ_RECONNECT_IVL.
763
764 Note
765 Values less than ZMQ_RECONNECT_IVL will be ignored.
766
767
768 Option value type int
769
770 Option value unit milliseconds
771
772 Default value 0 (only use
773 ZMQ_RECONNECT_IVL)
774
775 Applicable socket types all, only for
776 connection-oriented
777 transport
778
779
780 ZMQ_RECONNECT_STOP: Retrieve condition where reconnection will stop
781 The ZMQ_RECONNECT_STOP option shall retrieve the conditions under which
782 automatic reconnection will stop.
783
784 The ZMQ_RECONNECT_STOP_CONN_REFUSED option will stop reconnection when
785 0MQ receives the ECONNREFUSED return code from the connect. This
786 indicates that there is no code bound to the specified endpoint.
787
788
789 Option value type int
790
791 Option value unit ZMQ_RECONNECT_STOP_CONN_REFUSED
792
793 Default value 0
794
795 Applicable socket types all, only for
796 connection-oriented transports
797
798
799 ZMQ_RECOVERY_IVL: Get multicast recovery interval
800 The ZMQ_RECOVERY_IVL option shall retrieve the recovery interval for
801 multicast transports using the specified socket. The recovery interval
802 determines the maximum time in milliseconds that a receiver can be
803 absent from a multicast group before unrecoverable data loss will
804 occur.
805
806
807 Option value type int
808
809 Option value unit milliseconds
810
811 Default value 10000
812
813 Applicable socket types all, when using multicast
814 transports
815
816
817 ZMQ_ROUTING_ID: Retrieve socket routing id
818 The ZMQ_ROUTING_ID option shall retrieve the routing id of the
819 specified socket. Routing ids are used only by the request/reply
820 pattern. Specifically, it can be used in tandem with ROUTER socket to
821 route messages to the peer with a specific routing id.
822
823 A routing id must be at least one byte and at most 255 bytes long.
824 Identities starting with a zero byte are reserved for use by the 0MQ
825 infrastructure.
826
827
828 Option value type binary data
829
830 Option value unit N/A
831
832 Default value NULL
833
834 Applicable socket types ZMQ_REP, ZMQ_REQ,
835 ZMQ_ROUTER, ZMQ_DEALER.
836
837
838 ZMQ_SNDBUF: Retrieve kernel transmit buffer size
839 The ZMQ_SNDBUF option shall retrieve the underlying kernel transmit
840 buffer size for the specified socket. For details refer to your
841 operating system documentation for the SO_SNDBUF socket option.
842
843
844 Option value type int
845
846 Option value unit bytes
847
848 Default value 8192
849
850 Applicable socket types all
851
852
853 ZMQ_SNDHWM: Retrieves high water mark for outbound messages
854 The ZMQ_SNDHWM option shall return the high water mark for outbound
855 messages on the specified socket. The high water mark is a hard limit
856 on the maximum number of outstanding messages 0MQ shall queue in memory
857 for any single peer that the specified socket is communicating with. A
858 value of zero means no limit.
859
860 If this limit has been reached the socket shall enter an exceptional
861 state and depending on the socket type, 0MQ shall take appropriate
862 action such as blocking or dropping sent messages. Refer to the
863 individual socket descriptions in zmq_socket(3) for details on the
864 exact action taken for each socket type.
865
866
867 Option value type int
868
869 Option value unit messages
870
871 Default value 1000
872
873
874 Applicable socket types all
875
876
877 ZMQ_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN
878 Retrieve the timeout for send operation on the socket. If the value is
879 0, zmq_send(3) will return immediately, with a EAGAIN error if the
880 message cannot be sent. If the value is -1, it will block until the
881 message is sent. For all other values, it will try to send the message
882 for that amount of time before returning with an EAGAIN error.
883
884
885 Option value type int
886
887 Option value unit milliseconds
888
889 Default value -1 (infinite)
890
891 Applicable socket types all
892
893
894 ZMQ_SOCKS_PROXY: Retrieve SOCKS5 proxy address
895 The ZMQ_SOCKS_PROXY option shall retrieve the SOCKS5 proxy address in
896 string format. The returned value shall be a NULL-terminated string and
897 MAY be empty. The returned size SHALL include the terminating null
898 byte.
899
900
901 Option value type NULL-terminated character
902 string
903
904 Option value unit N/A
905
906 Default value null string
907
908 Applicable socket types all, when using TCP
909 transports
910
911
912 ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option
913 Override SO_KEEPALIVE socket option(where supported by OS). The default
914 value of -1 means to skip any overrides and leave it to OS default.
915
916
917 Option value type int
918
919 Option value unit -1,0,1
920
921 Default value -1 (leave to OS default)
922
923 Applicable socket types all, when using TCP
924 transports.
925
926
927 ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option
928 Override TCP_KEEPCNT socket option(where supported by OS). The default
929 value of -1 means to skip any overrides and leave it to OS default.
930
931
932 Option value type int
933
934 Option value unit -1,>0
935
936 Default value -1 (leave to OS default)
937
938 Applicable socket types all, when using TCP
939 transports.
940
941
942 ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPIDLE (or TCP_KEEPALIVE on some OS)
943 Override TCP_KEEPIDLE(or TCP_KEEPALIVE on some OS) socket option (where
944 supported by OS). The default value of -1 means to skip any overrides
945 and leave it to OS default.
946
947
948 Option value type int
949
950 Option value unit -1,>0
951
952 Default value -1 (leave to OS default)
953
954 Applicable socket types all, when using TCP
955 transports.
956
957
958 ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option
959 Override TCP_KEEPINTVL socket option(where supported by OS). The
960 default value of -1 means to skip any overrides and leave it to OS
961 default.
962
963
964 Option value type int
965
966 Option value unit -1,>0
967
968 Default value -1 (leave to OS default)
969
970 Applicable socket types all, when using TCP
971 transports.
972
973
974 ZMQ_TCP_MAXRT: Retrieve Max TCP Retransmit Timeout
975 On OSes where it is supported, retrieves how long before an
976 unacknowledged TCP retransmit times out. The system normally attempts
977 many TCP retransmits following an exponential backoff strategy. This
978 means that after a network outage, it may take a long time before the
979 session can be re-established. Setting this option allows the timeout
980 to happen at a shorter interval.
981
982
983 Option value type int
984
985 Option value unit milliseconds
986
987 Default value 0 (leave to OS default)
988
989 Applicable socket types all, when using TCP
990 transports.
991
992
993 ZMQ_THREAD_SAFE: Retrieve socket thread safety
994 The ZMQ_THREAD_SAFE option shall retrieve a boolean value indicating
995 whether or not the socket is threadsafe. See zmq_socket(3) for which
996 sockets are thread-safe.
997
998
999 Option value type int
1000
1001 Option value unit boolean
1002
1003 Applicable socket types all
1004
1005
1006 ZMQ_TOS: Retrieve the Type-of-Service socket override status
1007 Retrieve the IP_TOS option for the socket.
1008
1009
1010 Option value type int
1011
1012 Option value unit >0
1013
1014 Default value 0
1015
1016 Applicable socket types all, only for
1017 connection-oriented
1018 transports
1019
1020
1021 ZMQ_TYPE: Retrieve socket type
1022 The ZMQ_TYPE option shall retrieve the socket type for the specified
1023 socket. The socket type is specified at socket creation time and cannot
1024 be modified afterwards.
1025
1026
1027 Option value type int
1028
1029 Option value unit N/A
1030
1031 Default value N/A
1032
1033 Applicable socket types all
1034
1035
1036 ZMQ_ZAP_DOMAIN: Retrieve RFC 27 authentication domain
1037 The ZMQ_ZAP_DOMAIN option shall retrieve the last ZAP domain set for
1038 the socket. The returned value shall be a NULL-terminated string and
1039 MAY be empty. An empty string means that ZAP authentication is
1040 disabled. The returned size SHALL include the terminating null byte.
1041
1042
1043 Option value type character string
1044
1045 Option value unit N/A
1046
1047 Default value not set
1048
1049 Applicable socket types all, when using TCP
1050 transport
1051
1052
1053 ZMQ_ZAP_ENFORCE_DOMAIN: Retrieve ZAP domain handling mode
1054 The ZMQ_ZAP_ENFORCE_DOMAIN option shall retrieve the flag that
1055 determines whether a ZAP domain is strictly required or not.
1056
1057
1058 Option value type int
1059
1060 Option value unit 0, 1
1061
1062 Default value 0
1063
1064 Applicable socket types all, when using ZAP
1065
1066
1067 ZMQ_VMCI_BUFFER_SIZE: Retrieve buffer size of the VMCI socket
1068 The ZMQ_VMCI_BUFFER_SIZE option shall retrieve the size of the
1069 underlying buffer for the socket. Used during negotiation before the
1070 connection is established.
1071
1072
1073 Option value type uint64_t
1074
1075 Option value unit bytes
1076
1077
1078 Default value 65546
1079
1080 Applicable socket types all, when using VMCI
1081 transport
1082
1083
1084 ZMQ_VMCI_BUFFER_MIN_SIZE: Retrieve min buffer size of the VMCI socket
1085 The ZMQ_VMCI_BUFFER_MIN_SIZE option shall retrieve the min size of the
1086 underlying buffer for the socket. Used during negotiation before the
1087 connection is established.
1088
1089
1090 Option value type uint64_t
1091
1092 Option value unit bytes
1093
1094 Default value 128
1095
1096 Applicable socket types all, when using VMCI
1097 transport
1098
1099
1100 ZMQ_VMCI_BUFFER_MAX_SIZE: Retrieve max buffer size of the VMCI socket
1101 The ZMQ_VMCI_BUFFER_MAX_SIZE option shall retrieve the max size of the
1102 underlying buffer for the socket. Used during negotiation before the
1103 connection is established.
1104
1105
1106 Option value type uint64_t
1107
1108 Option value unit bytes
1109
1110 Default value 262144
1111
1112 Applicable socket types all, when using VMCI
1113 transport
1114
1115
1116 ZMQ_VMCI_CONNECT_TIMEOUT: Retrieve connection timeout of the VMCI socket
1117 The ZMQ_VMCI_CONNECT_TIMEOUT option shall retrieve connection timeout
1118 for the socket.
1119
1120
1121 Option value type int
1122
1123 Option value unit milliseconds
1124
1125 Default value -1
1126
1127 Applicable socket types all, when using VMCI
1128 transport
1129
1130
1131 ZMQ_MULTICAST_LOOP: Retrieve multicast local loopback configuration
1132 Retrieve the current multicast loopback configuration. A value of 1
1133 means that the multicast packets sent on this socket will be looped
1134 back to local listening interface.
1135
1136
1137 Option value type int
1138
1139 Option value unit 0, 1
1140
1141 Default value 1
1142
1143
1144
1145
1146 Applicable socket types ZMQ_RADIO, when using UDP
1147 multicast transport
1148
1149
1150 ZMQ_ROUTER_NOTIFY: Retrieve router socket notification settings
1151 Retrieve the current notification settings of a router socket. The
1152 returned value is a bitmask composed of ZMQ_NOTIFY_CONNECT and
1153 ZMQ_NOTIFY_DISCONNECT flags, meaning connect and disconnect
1154 notifications are enabled, respectively. A value of 0 means the
1155 notifications are off.
1156
1157 Note
1158 in DRAFT state, not yet available in stable releases.
1159
1160
1161 Option value type int
1162
1163 Option value unit 0, ZMQ_NOTIFY_CONNECT,
1164 ZMQ_NOTIFY_DISCONNECT,
1165 ZMQ_NOTIFY_CONNECT |
1166 ZMQ_NOTIFY_DISCONNECT
1167
1168 Default value 0
1169
1170 Applicable socket types ZMQ_ROUTER
1171
1172
1173 ZMQ_IN_BATCH_SIZE: Maximal receive batch size
1174 Gets the maximal amount of messages that can be received in a single
1175 recv system call.
1176
1177 Cannot be zero.
1178
1179 Note
1180 in DRAFT state, not yet available in stable releases.
1181
1182
1183 Option value type int
1184
1185 Option value unit messages
1186
1187 Default value 8192
1188
1189 Applicable socket types All, when using TCP, IPC,
1190 PGM or NORM transport.
1191
1192
1193 ZMQ_OUT_BATCH_SIZE: Maximal send batch size
1194 Gets the maximal amount of messages that can be sent in a single send
1195 system call.
1196
1197 Cannot be zero.
1198
1199 Note
1200 in DRAFT state, not yet available in stable releases.
1201
1202
1203 Option value type int
1204
1205 Option value unit messages
1206
1207 Default value 8192
1208
1209 Applicable socket types All, when using TCP, IPC,
1210 PGM or NORM transport.
1211
1212
1214 The zmq_getsockopt() function shall return zero if successful.
1215 Otherwise it shall return -1 and set errno to one of the values defined
1216 below.
1217
1219 EINVAL
1220 The requested option option_name is unknown, or the requested
1221 option_len or option_value is invalid, or the size of the buffer
1222 pointed to by option_value, as specified by option_len, is
1223 insufficient for storing the option value.
1224
1225 ETERM
1226 The 0MQ context associated with the specified socket was
1227 terminated.
1228
1229 ENOTSOCK
1230 The provided socket was invalid.
1231
1232 EINTR
1233 The operation was interrupted by delivery of a signal.
1234
1236 Retrieving the high water mark for outgoing messages.
1237
1238 /* Retrieve high water mark into sndhwm */
1239 int sndhwm;
1240 size_t sndhwm_size = sizeof (sndhwm);
1241 rc = zmq_getsockopt (socket, ZMQ_SNDHWM, &sndhwm, &sndhwm_size);
1242 assert (rc == 0);
1243
1244
1246 zmq_setsockopt(3) zmq_socket(3) zmq(7)
1247
1249 This page was written by the 0MQ community. To make a change please
1250 read the 0MQ Contribution Policy at
1251 http://www.zeromq.org/docs:contributing.
1252
1253
1254
12550MQ 4.3.4 07/23/2022 ZMQ_GETSOCKOPT(3)