'\" t .\" Title: xs_bind .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 .\" Date: 06/13/2012 .\" Manual: Crossroads I/O Manual .\" Source: Crossroads I/O 1.2.0 .\" Language: English .\" .TH "XS_BIND" "3" "06/13/2012" "Crossroads I/O 1\&.2\&.0" "Crossroads I/O Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" xs_bind \- accept connections on a socket .SH "SYNOPSIS" .sp \fBint xs_bind (void \fR\fB\fI*socket\fR\fR\fB, const char \fR\fB\fI*endpoint\fR\fR\fB);\fR .SH "DESCRIPTION" .sp The \fIxs_bind()\fR function shall create an endpoint for accepting connections and bind it to the socket referenced by the \fIsocket\fR argument\&. .sp 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\&. .sp The following transports are defined: .PP \fIinproc\fR .RS 4 local in\-process (inter\-thread) communication transport, see \fBxs_inproc\fR(7) .RE .PP \fIipc\fR .RS 4 local inter\-process communication transport, see \fBxs_ipc\fR(7) .RE .PP \fItcp\fR .RS 4 unicast transport using TCP, see \fBxs_tcp\fR(7) .RE .PP \fIpgm\fR, \fIepgm\fR .RS 4 reliable multicast transport using PGM, see \fBxs_pgm\fR(7) .RE .sp With the exception of \fIXS_PAIR\fR sockets, a single socket may be connected to multiple endpoints using \fIxs_connect()\fR, while simultaneously accepting incoming connections from multiple endpoints bound to the socket using \fIxs_bind()\fR\&. Refer to \fBxs_socket\fR(3) for a description of the exact semantics involved when connecting or binding a socket to multiple endpoints\&. .SH "RETURN VALUE" .sp The \fIxs_bind()\fR function shall return endpoint ID if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. .SH "ERRORS" .PP \fBEINVAL\fR .RS 4 The endpoint supplied is invalid\&. .RE .PP \fBENAMETOOLONG\fR .RS 4 The supplied name was too long\&. .RE .PP \fBEPROTONOSUPPORT\fR .RS 4 The requested \fItransport\fR protocol is not supported\&. .RE .PP \fBENOCOMPATPROTO\fR .RS 4 The requested \fItransport\fR protocol is not compatible with the socket type\&. .RE .PP \fBEADDRINUSE\fR .RS 4 The requested \fIaddress\fR is already in use\&. .RE .PP \fBEADDRNOTAVAIL\fR .RS 4 The requested \fIaddress\fR was not local\&. .RE .PP \fBENODEV\fR .RS 4 The requested \fIaddress\fR specifies a nonexistent interface\&. .RE .PP \fBETERM\fR .RS 4 The \fIcontext\fR associated with the specified \fIsocket\fR was terminated\&. .RE .PP \fBENOTSOCK\fR .RS 4 The provided \fIsocket\fR was invalid\&. .RE .SH "EXAMPLE" .PP \fBBinding a publisher socket to an in-process and a TCP transport\fR. .sp .if n \{\ .RS 4 .\} .nf /* Create a XS_PUB socket */ void *socket = xs_socket (context, XS_PUB); assert (socket); /* Bind it to a in\-process transport with the address \*(Aqmy_publisher\*(Aq */ int rc = xs_bind (socket, "inproc://my_publisher"); assert (rc != \-1); /* Bind it to a TCP transport on port 5555 of the \*(Aqeth0\*(Aq interface */ rc = xs_bind (socket, "tcp://eth0:5555"); assert (rc != \-1); .fi .if n \{\ .RE .\} .sp .SH "SEE ALSO" .sp \fBxs_connect\fR(3) \fBxs_socket\fR(3) \fBxs\fR(7) .SH "AUTHORS" .sp The Crossroads 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>\&. .SH "NOTES" .IP " 1." 4 sustrik@250bpm.com .RS 4 \%mailto:sustrik@250bpm.com .RE .IP " 2." 4 martin@lucina.net .RS 4 \%mailto:martin@lucina.net .RE