~ubuntu-branches/ubuntu/precise/zeromq/precise

« back to all changes in this revision

Viewing changes to doc/zmq_setsockopt.3

  • Committer: Bazaar Package Importer
  • Author(s): Martin Lucina
  • Date: 2011-05-13 12:43:09 UTC
  • mfrom: (7.2.1 sid)
  • Revision ID: james.westby@ubuntu.com-20110513124309-m3gdt964ga67rcwu
Tags: 2.1.7-1
* New upstream version. (closes: #619374)
* --with-system-pgm is now used instead of the embedded OpenPGM library. 
* Added Debian watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
.\"     Title: zmq_setsockopt
3
3
.\"    Author: [see the "AUTHORS" section]
4
4
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
5
 
.\"      Date: 10/15/2010
 
5
.\"      Date: 05/07/2011
6
6
.\"    Manual: 0MQ Manual
7
 
.\"    Source: 0MQ 2.0.10
 
7
.\"    Source: 0MQ 2.1.6
8
8
.\"  Language: English
9
9
.\"
10
 
.TH "ZMQ_SETSOCKOPT" "3" "10/15/2010" "0MQ 2\&.0\&.10" "0MQ Manual"
 
10
.TH "ZMQ_SETSOCKOPT" "3" "05/07/2011" "0MQ 2\&.1\&.6" "0MQ Manual"
11
11
.\" -----------------------------------------------------------------
12
12
.\" * Define some portability stuff
13
13
.\" -----------------------------------------------------------------
32
32
.SH "SYNOPSIS"
33
33
.sp
34
34
\fBint zmq_setsockopt (void \fR\fB\fI*socket\fR\fR\fB, int \fR\fB\fIoption_name\fR\fR\fB, const void \fR\fB\fI*option_value\fR\fR\fB, size_t \fR\fB\fIoption_len\fR\fR\fB);\fR
 
35
.sp
 
36
Caution: All options, with the exception of ZMQ_SUBSCRIBE, ZMQ_UNSUBSCRIBE and ZMQ_LINGER, only take effect for subsequent socket bind/connects\&.
35
37
.SH "DESCRIPTION"
36
38
.sp
37
39
The \fIzmq_setsockopt()\fR function shall set the option specified by the \fIoption_name\fR argument to the value pointed to by the \fIoption_value\fR argument for the 0MQ socket pointed to by the \fIsocket\fR argument\&. The \fIoption_len\fR argument is the size of the option value in bytes\&.
166
168
.sp 1
167
169
.SS "ZMQ_IDENTITY: Set socket identity"
168
170
.sp
169
 
The \fIZMQ_IDENTITY\fR option shall set the identity of the specified \fIsocket\fR\&. Socket identity determines if existing 0MQ infastructure (\fImessage queues\fR, \fIforwarding devices\fR) shall be identified with a specific application and persist across multiple runs of the application\&.
 
171
The \fIZMQ_IDENTITY\fR option shall set the identity of the specified \fIsocket\fR\&. Socket identity determines if existing 0MQ infrastructure (\fImessage queues\fR, \fIforwarding devices\fR) shall be identified with a specific application and persist across multiple runs of the application\&.
170
172
.sp
171
173
If the socket has no identity, each run of an application is completely separate from other runs\&. However, with identity set the socket shall re\-use any existing 0MQ infrastructure configured by the previous run(s)\&. Thus the application may receive messages that were sent in the meantime, \fImessage queue\fR limits shall be shared with previous run(s) and so on\&.
172
174
.sp
211
213
.sp
212
214
The \fIZMQ_SUBSCRIBE\fR option shall establish a new message filter on a \fIZMQ_SUB\fR socket\&. Newly created \fIZMQ_SUB\fR sockets shall filter out all incoming messages, therefore you should call this option to establish an initial message filter\&.
213
215
.sp
214
 
An empty \fIoption_value\fR of length zero shall subscribe to all incoming messages\&. A non\-empty \fIoption_value\fR shall subscribe to all messages beginning with the specified prefix\&. Mutiple filters may be attached to a single \fIZMQ_SUB\fR socket, in which case a message shall be accepted if it matches at least one filter\&.
 
216
An empty \fIoption_value\fR of length zero shall subscribe to all incoming messages\&. A non\-empty \fIoption_value\fR shall subscribe to all messages beginning with the specified prefix\&. Multiple filters may be attached to a single \fIZMQ_SUB\fR socket, in which case a message shall be accepted if it matches at least one filter\&.
215
217
.TS
216
218
tab(:);
217
219
lt lt
342
344
.ps -1
343
345
.br
344
346
.sp
345
 
Excersize care when setting large recovery intervals as the data needed for recovery will be held in memory\&. For example, a 1 minute recovery interval at a data rate of 1Gbps requires a 7GB in\-memory buffer\&.
 
347
Exercise care when setting large recovery intervals as the data needed for recovery will be held in memory\&. For example, a 1 minute recovery interval at a data rate of 1Gbps requires a 7GB in\-memory buffer\&.
346
348
.sp .5v
347
349
.RE
348
350
.TS
381
383
T}
382
384
.TE
383
385
.sp 1
384
 
.SS "ZMQ_MCAST_LOOP: Control multicast loopback"
385
 
.sp
386
 
The \fIZMQ_MCAST_LOOP\fR option shall control whether data sent via multicast transports using the specified \fIsocket\fR can also be received by the sending host via loopback\&. A value of zero disables the loopback functionality, while the default value of 1 enables the loopback functionality\&. Leaving multicast loopback enabled when it is not required can have a negative impact on performance\&. Where possible, disable \fIZMQ_MCAST_LOOP\fR in production environments\&.
 
386
.SS "ZMQ_RECOVERY_IVL_MSEC: Set multicast recovery interval in milliseconds"
 
387
.sp
 
388
The \fIZMQ_RECOVERY_IVL_MSEC\fR option shall set the recovery interval, specified in milliseconds (ms) for multicast transports using the specified \fIsocket\fR\&. The recovery interval determines the maximum time in milliseconds that a receiver can be absent from a multicast group before unrecoverable data loss will occur\&.
 
389
.sp
 
390
A non\-zero value of the \fIZMQ_RECOVERY_IVL_MSEC\fR option will take precedence over the \fIZMQ_RECOVERY_IVL\fR option, but since the default for the \fIZMQ_RECOVERY_IVL_MSEC\fR is \-1, the default is to use the \fIZMQ_RECOVERY_IVL\fR option value\&.
 
391
.if n \{\
 
392
.sp
 
393
.\}
 
394
.RS 4
 
395
.it 1 an-trap
 
396
.nr an-no-space-flag 1
 
397
.nr an-break-flag 1
 
398
.br
 
399
.ps +1
 
400
\fBCaution\fR
 
401
.ps -1
 
402
.br
 
403
.sp
 
404
Exercise care when setting large recovery intervals as the data needed for recovery will be held in memory\&. For example, a 1 minute recovery interval at a data rate of 1Gbps requires a 7GB in\-memory buffer\&.
 
405
.sp .5v
 
406
.RE
 
407
.TS
 
408
tab(:);
 
409
lt lt
 
410
lt lt
 
411
lt lt
 
412
lt lt.
 
413
T{
 
414
.sp
 
415
Option value type
 
416
T}:T{
 
417
.sp
 
418
int64_t
 
419
T}
 
420
T{
 
421
.sp
 
422
Option value unit
 
423
T}:T{
 
424
.sp
 
425
milliseconds
 
426
T}
 
427
T{
 
428
.sp
 
429
Default value
 
430
T}:T{
 
431
.sp
 
432
\-1
 
433
T}
 
434
T{
 
435
.sp
 
436
Applicable socket types
 
437
T}:T{
 
438
.sp
 
439
all, when using multicast transports
 
440
T}
 
441
.TE
 
442
.sp 1
 
443
.SS "ZMQ_MCAST_LOOP: Control multicast loop\-back"
 
444
.sp
 
445
The \fIZMQ_MCAST_LOOP\fR option shall control whether data sent via multicast transports using the specified \fIsocket\fR can also be received by the sending host via loop\-back\&. A value of zero disables the loop\-back functionality, while the default value of 1 enables the loop\-back functionality\&. Leaving multicast loop\-back enabled when it is not required can have a negative impact on performance\&. Where possible, disable \fIZMQ_MCAST_LOOP\fR in production environments\&.
387
446
.TS
388
447
tab(:);
389
448
lt lt
498
557
T}
499
558
.TE
500
559
.sp 1
 
560
.SS "ZMQ_LINGER: Set linger period for socket shutdown"
 
561
.sp
 
562
The \fIZMQ_LINGER\fR option shall set the linger period for the specified \fIsocket\fR\&. The linger period determines how long pending messages which have yet to be sent to a peer shall linger in memory after a socket is closed with \fBzmq_close\fR(3), and further affects the termination of the socket\(cqs context with \fBzmq_term\fR(3)\&. The following outlines the different behaviours:
 
563
.sp
 
564
.RS 4
 
565
.ie n \{\
 
566
\h'-04'\(bu\h'+03'\c
 
567
.\}
 
568
.el \{\
 
569
.sp -1
 
570
.IP \(bu 2.3
 
571
.\}
 
572
The default value of
 
573
\fI\-1\fR
 
574
specifies an infinite linger period\&. Pending messages shall not be discarded after a call to
 
575
\fIzmq_close()\fR; attempting to terminate the socket\(cqs context with
 
576
\fIzmq_term()\fR
 
577
shall block until all pending messages have been sent to a peer\&.
 
578
.RE
 
579
.sp
 
580
.RS 4
 
581
.ie n \{\
 
582
\h'-04'\(bu\h'+03'\c
 
583
.\}
 
584
.el \{\
 
585
.sp -1
 
586
.IP \(bu 2.3
 
587
.\}
 
588
The value of
 
589
\fI0\fR
 
590
specifies no linger period\&. Pending messages shall be discarded immediately when the socket is closed with
 
591
\fIzmq_close()\fR\&.
 
592
.RE
 
593
.sp
 
594
.RS 4
 
595
.ie n \{\
 
596
\h'-04'\(bu\h'+03'\c
 
597
.\}
 
598
.el \{\
 
599
.sp -1
 
600
.IP \(bu 2.3
 
601
.\}
 
602
Positive values specify an upper bound for the linger period in milliseconds\&. Pending messages shall not be discarded after a call to
 
603
\fIzmq_close()\fR; attempting to terminate the socket\(cqs context with
 
604
\fIzmq_term()\fR
 
605
shall block until either all pending messages have been sent to a peer, or the linger period expires, after which any pending messages shall be discarded\&.
 
606
.TS
 
607
tab(:);
 
608
lt lt
 
609
lt lt
 
610
lt lt
 
611
lt lt.
 
612
T{
 
613
Option value type
 
614
T}:T{
 
615
int
 
616
T}
 
617
T{
 
618
Option value unit
 
619
T}:T{
 
620
milliseconds
 
621
T}
 
622
T{
 
623
Default value
 
624
T}:T{
 
625
\-1 (infinite)
 
626
T}
 
627
T{
 
628
Applicable socket types
 
629
T}:T{
 
630
all
 
631
T}
 
632
.TE
 
633
.sp 1
 
634
.RE
 
635
.SS "ZMQ_RECONNECT_IVL: Set reconnection interval"
 
636
.sp
 
637
The \fIZMQ_RECONNECT_IVL\fR option shall set the initial reconnection interval for the specified \fIsocket\fR\&. The reconnection interval is the period 0MQ shall wait between attempts to reconnect disconnected peers when using connection\-oriented transports\&.
 
638
.if n \{\
 
639
.sp
 
640
.\}
 
641
.RS 4
 
642
.it 1 an-trap
 
643
.nr an-no-space-flag 1
 
644
.nr an-break-flag 1
 
645
.br
 
646
.ps +1
 
647
\fBNote\fR
 
648
.ps -1
 
649
.br
 
650
.sp
 
651
The reconnection interval may be randomized by 0MQ to prevent reconnection storms in topologies with a large number of peers per socket\&.
 
652
.sp .5v
 
653
.RE
 
654
.TS
 
655
tab(:);
 
656
lt lt
 
657
lt lt
 
658
lt lt
 
659
lt lt.
 
660
T{
 
661
.sp
 
662
Option value type
 
663
T}:T{
 
664
.sp
 
665
int
 
666
T}
 
667
T{
 
668
.sp
 
669
Option value unit
 
670
T}:T{
 
671
.sp
 
672
milliseconds
 
673
T}
 
674
T{
 
675
.sp
 
676
Default value
 
677
T}:T{
 
678
.sp
 
679
100
 
680
T}
 
681
T{
 
682
.sp
 
683
Applicable socket types
 
684
T}:T{
 
685
.sp
 
686
all, only for connection\-oriented transports
 
687
T}
 
688
.TE
 
689
.sp 1
 
690
.SS "ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval"
 
691
.sp
 
692
The \fIZMQ_RECONNECT_IVL_MAX\fR option shall set the maximum reconnection interval for the specified \fIsocket\fR\&. This is the maximum period 0MQ shall wait between attempts to reconnect\&. On each reconnect attempt, the previous interval shall be doubled untill ZMQ_RECONNECT_IVL_MAX is reached\&. This allows for exponential backoff strategy\&. Default value means no exponential backoff is performed and reconnect interval calculations are only based on ZMQ_RECONNECT_IVL\&.
 
693
.if n \{\
 
694
.sp
 
695
.\}
 
696
.RS 4
 
697
.it 1 an-trap
 
698
.nr an-no-space-flag 1
 
699
.nr an-break-flag 1
 
700
.br
 
701
.ps +1
 
702
\fBNote\fR
 
703
.ps -1
 
704
.br
 
705
.sp
 
706
Values less than ZMQ_RECONNECT_IVL will be ignored\&.
 
707
.sp .5v
 
708
.RE
 
709
.TS
 
710
tab(:);
 
711
lt lt
 
712
lt lt
 
713
lt lt
 
714
lt lt.
 
715
T{
 
716
.sp
 
717
Option value type
 
718
T}:T{
 
719
.sp
 
720
int
 
721
T}
 
722
T{
 
723
.sp
 
724
Option value unit
 
725
T}:T{
 
726
.sp
 
727
milliseconds
 
728
T}
 
729
T{
 
730
.sp
 
731
Default value
 
732
T}:T{
 
733
.sp
 
734
0 (only use ZMQ_RECONNECT_IVL)
 
735
T}
 
736
T{
 
737
.sp
 
738
Applicable socket types
 
739
T}:T{
 
740
.sp
 
741
all, only for connection\-oriented transports
 
742
T}
 
743
.TE
 
744
.sp 1
 
745
.SS "ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections"
 
746
.sp
 
747
The \fIZMQ_BACKLOG\fR option shall set the maximum length of the queue of outstanding peer connections for the specified \fIsocket\fR; this only applies to connection\-oriented transports\&. For details refer to your operating system documentation for the \fIlisten\fR function\&.
 
748
.TS
 
749
tab(:);
 
750
lt lt
 
751
lt lt
 
752
lt lt
 
753
lt lt.
 
754
T{
 
755
.sp
 
756
Option value type
 
757
T}:T{
 
758
.sp
 
759
int
 
760
T}
 
761
T{
 
762
.sp
 
763
Option value unit
 
764
T}:T{
 
765
.sp
 
766
connections
 
767
T}
 
768
T{
 
769
.sp
 
770
Default value
 
771
T}:T{
 
772
.sp
 
773
100
 
774
T}
 
775
T{
 
776
.sp
 
777
Applicable socket types
 
778
T}:T{
 
779
.sp
 
780
all, only for connection\-oriented transports\&.
 
781
T}
 
782
.TE
 
783
.sp 1
501
784
.SH "RETURN VALUE"
502
785
.sp
503
786
The \fIzmq_setsockopt()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&.
523
806
was terminated\&.
524
807
.RE
525
808
.PP
526
 
\fBEFAULT\fR
 
809
\fBENOTSOCK\fR
527
810
.RS 4
528
811
The provided
529
812
\fIsocket\fR
530
 
was not valid (NULL)\&.
 
813
was invalid\&.
 
814
.RE
 
815
.PP
 
816
\fBEINTR\fR
 
817
.RS 4
 
818
The operation was interrupted by delivery of a signal\&.
531
819
.RE
532
820
.SH "EXAMPLE"
533
821
.PP
576
864
\fBzmq_getsockopt\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7)
577
865
.SH "AUTHORS"
578
866
.sp
579
 
The 0MQ documentation was written by Martin Sustrik <\m[blue]\fBsustrik@250bpm\&.com\fR\m[]\&\s-2\u[1]\d\s+2> and Martin Lucina <\m[blue]\fBmato@kotelna\&.sk\fR\m[]\&\s-2\u[2]\d\s+2>\&.
 
867
This 0MQ manual page was written by Martin Sustrik <\m[blue]\fBsustrik@250bpm\&.com\fR\m[]\&\s-2\u[1]\d\s+2> and Martin Lucina <\m[blue]\fBmato@kotelna\&.sk\fR\m[]\&\s-2\u[2]\d\s+2>\&.
580
868
.SH "NOTES"
581
869
.IP " 1." 4
582
870
sustrik@250bpm.com