libzmq/man/man3/zmq_connect.3

50 lines
1.3 KiB
Groff
Raw Normal View History

.TH zmq_connect 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals"
2009-11-22 08:47:06 +01:00
.SH NAME
2009-11-22 16:51:21 +01:00
zmq_connect \- connect the socket to the specified peer
2009-11-22 08:47:06 +01:00
.SH SYNOPSIS
.B int zmq_connect (void *s, const char *addr);
.SH DESCRIPTION
2009-11-22 16:51:21 +01:00
The function connect socket
.IR s
to the peer identified by
2009-11-22 16:51:21 +01:00
.IR addr .
Actual semantics of the command depend on the underlying transport mechanism,
2010-01-18 13:16:14 +01:00
however, in cases where peers connect in an asymmetric manner,
2009-11-22 16:51:21 +01:00
.IR zmq_bind
should be called first,
.IR zmq_connect
afterwards. Formats of the
2009-11-22 16:51:21 +01:00
.IR addr
parameter are defined by individual transports. For a list of supported
transports have a look at
.IR zmq(7)
manual page.
2009-11-22 16:51:21 +01:00
Note that single socket can be connected (and bound) to
arbitrary number of peers using different transport mechanisms.
2009-11-22 08:47:06 +01:00
.SH RETURN VALUE
2009-11-22 16:51:21 +01:00
In case of success the function returns zero. Otherwise it returns -1 and
sets
.IR errno
to the appropriate value.
2009-11-22 08:47:06 +01:00
.SH ERRORS
2009-11-22 16:51:21 +01:00
.IP "\fBEPROTONOSUPPORT\fP"
unsupported protocol.
.IP "\fBENOCOMPATPROTO\fP"
protocol is not compatible with the socket type.
2009-11-22 08:47:06 +01:00
.SH EXAMPLE
2009-11-22 16:51:21 +01:00
.nf
void *s = zmq_socket (context, ZMQ_SUB);
assert (s);
int rc = zmq_connect (s, "inproc://my_publisher");
assert (rc == 0);
rc = zmq_connect (s, "tcp://server001:5555");
assert (rc == 0);
.fi
2009-11-22 08:47:06 +01:00
.SH SEE ALSO
2009-11-22 16:51:21 +01:00
.BR zmq_bind (3)
.BR zmq_socket (3)
.BR zmq (7)
2009-11-22 08:47:06 +01:00
.SH AUTHOR
Martin Sustrik <sustrik at 250bpm dot com>