3
.\" Author: [see the "AUTHORS" section]
4
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
10
.TH "ZMQ_BIND" "3" "12/18/2011" "0MQ 3\&.1\&.0" "0MQ Manual"
11
.\" -----------------------------------------------------------------
12
.\" * Define some portability stuff
13
.\" -----------------------------------------------------------------
14
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15
.\" http://bugs.debian.org/507673
16
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20
.\" -----------------------------------------------------------------
21
.\" * set default formatting
22
.\" -----------------------------------------------------------------
23
.\" disable hyphenation
25
.\" disable justification (adjust text to left margin only)
27
.\" -----------------------------------------------------------------
28
.\" * MAIN CONTENT STARTS HERE *
29
.\" -----------------------------------------------------------------
31
zmq_bind \- accept connections on a socket
34
\fBint zmq_bind (void \fR\fB\fI*socket\fR\fR\fB, const char \fR\fB\fI*endpoint\fR\fR\fB);\fR
37
The \fIzmq_bind()\fR function shall create an endpoint for accepting connections and bind it to the socket referenced by the \fIsocket\fR argument\&.
39
The \fIendpoint\fR argument is a string consisting of two parts as follows: \fItransport\fR://\fIaddress\fR\&. The \fItransport\fR part specifies the underlying transport protocol to use\&. The meaning of the \fIaddress\fR part is specific to the underlying transport protocol selected\&.
41
The following transports are defined:
45
local in\-process (inter\-thread) communication transport, see
51
local inter\-process communication transport, see
57
unicast transport using TCP, see
63
reliable multicast transport using PGM, see
67
With the exception of \fIZMQ_PAIR\fR sockets, a single socket may be connected to multiple endpoints using \fIzmq_connect()\fR, while simultaneously accepting incoming connections from multiple endpoints bound to the socket using \fIzmq_bind()\fR\&. Refer to \fBzmq_socket\fR(3) for a description of the exact semantics involved when connecting or binding a socket to multiple endpoints\&.
70
The \fIzmq_bind()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&.
75
The endpoint supplied is invalid\&.
82
protocol is not supported\&.
89
protocol is not compatible with the socket type\&.
110
specifies a nonexistent interface\&.
117
associated with the specified
131
No I/O thread is available to accomplish the task\&.
135
\fBBinding a publisher socket to an in-process and a TCP transport\fR.
141
/* Create a ZMQ_PUB socket */
142
void *socket = zmq_socket (context, ZMQ_PUB);
144
/* Bind it to a in\-process transport with the address \*(Aqmy_publisher\*(Aq */
145
int rc = zmq_bind (socket, "inproc://my_publisher");
147
/* Bind it to a TCP transport on port 5555 of the \*(Aqeth0\*(Aq interface */
148
rc = zmq_bind (socket, "tcp://eth0:5555");
157
\fBzmq_connect\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7)
160
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]\fBmartin@lucina\&.net\fR\m[]\&\s-2\u[2]\d\s+2>\&.
165
\%mailto:sustrik@250bpm.com
170
\%mailto:martin@lucina.net