'\" t .\" Title: xs_socket .\" 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_SOCKET" "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_socket \- create Crossroads socket .SH "SYNOPSIS" .sp \fBvoid *xs_socket (void \fR\fB\fI*context\fR\fR\fB, int \fR\fB\fItype\fR\fR\fB);\fR .SH "DESCRIPTION" .sp The \fIxs_socket()\fR function shall create a Crossroads socket within the specified \fIcontext\fR and return an opaque handle to the newly created socket\&. The \fItype\fR argument specifies the socket type, which determines the semantics of communication over the socket\&. .sp The newly created socket is initially unbound, and not associated with any endpoints\&. In order to establish a message flow a socket must first be connected to at least one endpoint with \fBxs_connect\fR(3), or at least one endpoint must be created for accepting incoming connections with \fBxs_bind\fR(3)\&. .PP \fBKey differences to conventional sockets\fR. Generally speaking, conventional sockets present a \fIsynchronous\fR interface to either connection\-oriented reliable byte streams (SOCK_STREAM), or connection\-less unreliable datagrams (SOCK_DGRAM)\&. In comparison, Crossroads sockets present an abstraction of an asynchronous \fImessage queue\fR, with the exact queueing semantics depending on the socket type in use\&. Where conventional sockets transfer streams of bytes or discrete datagrams, Crossroads sockets transfer discrete \fImessages\fR\&. .sp Crossroads sockets being \fIasynchronous\fR means that the timings of the physical connection setup and tear down, reconnect and effective delivery are transparent to the user and organized by Crossroads library itself\&. Further, messages may be \fIqueued\fR in the event that a peer is unavailable to receive them\&. .sp Conventional sockets allow only strict one\-to\-one (two peers), many\-to\-one (many clients, one server), or in some cases one\-to\-many (multicast) relationships\&. With the exception of \fIXS_PAIR\fR, Crossroads sockets may be connected \fBto multiple endpoints\fR using \fIxs_connect()\fR, while simultaneously accepting incoming connections \fBfrom multiple endpoints\fR bound to the socket using \fIxs_bind()\fR, thus allowing many\-to\-many relationships\&. .PP \fBThread safety\fR. Crossroads \fIsockets\fR are \fInot\fR thread safe\&. Applications MUST NOT use a socket from multiple threads except after migrating a socket from one thread to another with a "full fence" memory barrier\&. .PP \fBSocket types\fR. Crossroads defines several messaging patterns which encapsulate exact semantics of a particular topology\&. For example, publish\-subscribe pattern defines data distribution trees while request\-reply defines networks of shared stateless services\&. Each pattern defines several socket types (roles in the pattern)\&. .sp The following sections present the socket types defined by Crossroads library: .SS "Request\-reply pattern" .sp The request\-reply pattern is used for sending requests from a \fIclient\fR to one or more instances of a stateless \fIservice\fR, and receiving subsequent replies to each request sent\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBXS_REQ\fR .RS 4 .sp A socket of type \fIXS_REQ\fR is used by a \fIclient\fR to send requests to and receive replies from a \fIservice\fR\&. This socket type allows only an alternating sequence of \fIxs_send(request)\fR and subsequent \fIxs_recv(reply)\fR calls\&. Each request sent is load\-balanced among all \fIservices\fR, and each reply received is matched with the last issued request\&. .sp When a \fIXS_REQ\fR socket enters an exceptional state due to having reached the high water mark for all \fIservices\fR, or if there are no \fIservices\fR at all, then any \fBxs_send\fR(3) operations on the socket shall block until the exceptional state ends or at least one \fIservice\fR becomes available for sending; messages are not discarded\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .B Table\ \&1.\ \&Summary of XS_REQ characteristics .TS tab(:); lt lt lt lt lt lt lt lt lt lt. T{ .sp Compatible peer sockets T}:T{ .sp \fIXS_REP\fR T} T{ .sp Send/receive pattern T}:T{ .sp Send, Receive, Send, Receive, \&... T} T{ .sp Outgoing routing strategy T}:T{ .sp Load\-balanced T} T{ .sp Incoming routing strategy T}:T{ .sp Last peer T} T{ .sp XS_HWM option action T}:T{ .sp Block T} .TE .sp 1 .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBXS_REP\fR .RS 4 .sp A socket of type \fIXS_REP\fR is used by a \fIservice\fR to receive requests from and send replies to a \fIclient\fR\&. This socket type allows only an alternating sequence of \fIxs_recv(request)\fR and subsequent \fIxs_send(reply)\fR calls\&. Each request received is fair\-queued from among all \fIclients\fR, and each reply sent is routed to the \fIclient\fR that issued the last request\&. If the original requester doesn\(cqt exist any more the reply is silently discarded\&. .sp When a \fIXS_REP\fR socket enters an exceptional state due to having reached the high water mark for a \fIclient\fR, then any replies sent to the \fIclient\fR in question shall be dropped until the exceptional state ends\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .B Table\ \&2.\ \&Summary of XS_REP characteristics .TS tab(:); lt lt lt lt lt lt lt lt lt lt. T{ .sp Compatible peer sockets T}:T{ .sp \fIXS_REQ\fR T} T{ .sp Send/receive pattern T}:T{ .sp Receive, Send, Receive, Send, \&... T} T{ .sp Incoming routing strategy T}:T{ .sp Fair\-queued T} T{ .sp Outgoing routing strategy T}:T{ .sp Last peer T} T{ .sp XS_HWM option action T}:T{ .sp Drop T} .TE .sp 1 .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBXS_XREQ\fR .RS 4 .sp A socket of type \fIXS_XREQ\fR is a socket type underlying \fIXS_REQ\fR\&. It doesn\(cqt impose the strict order of sends and recvs as \fIXS_REQ\fR does and it is intended for use in intermediate devices in request\-reply topologies\&. .sp Each message sent is load\-balanced among all connected peers, and each message received is fair\-queued from all connected peers\&. .sp When a \fIXS_XREQ\fR socket enters an exceptional state due to having reached the high water mark for all peers, or if there are no peers at all, then any \fBxs_send\fR(3) operations on the socket shall block until the exceptional state ends or at least one peer becomes available for sending; messages are not discarded\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .B Table\ \&3.\ \&Summary of XS_XREQ characteristics .TS tab(:); lt lt lt lt lt lt lt lt lt lt. T{ .sp Compatible peer sockets T}:T{ .sp \fIXS_XREP\fR, \fIXS_REP\fR T} T{ .sp Send/receive pattern T}:T{ .sp Unrestricted T} T{ .sp Outgoing routing strategy T}:T{ .sp Load\-balanced T} T{ .sp Incoming routing strategy T}:T{ .sp Fair\-queued T} T{ .sp XS_HWM option action T}:T{ .sp Block T} .TE .sp 1 .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBXS_XREP\fR .RS 4 .sp A socket of type \fIXS_XREP\fR is a socket type underlying \fIXS_REP\fR\&. It doesn\(cqt impose the strict order of sends and recvs as \fIXS_REQ\fR does and it is intended for use in intermediate devices in request\-reply topologies\&. .sp Messages received are fair\-queued from among all connected peers\&. The outbound messages are routed to a specific peer, as explained below\&. .sp When a \fIXS_XREP\fR socket enters an exceptional state due to having reached the high water mark for all peers, or if there are no peers at all, then any messages sent to the socket shall be dropped until the exceptional state ends\&. Likewise, any messages to be routed to a non\-existent peer or a peer for which the individual high water mark has been reached shall also be dropped\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .B Table\ \&4.\ \&Summary of XS_XREP characteristics .TS tab(:); lt lt lt lt lt lt lt lt lt lt. T{ .sp Compatible peer sockets T}:T{ .sp \fIXS_XREQ\fR, \fIXS_REQ\fR T} T{ .sp Send/receive pattern T}:T{ .sp Unrestricted T} T{ .sp Outgoing routing strategy T}:T{ .sp See text T} T{ .sp Incoming routing strategy T}:T{ .sp Fair\-queued T} T{ .sp XS_HWM option action T}:T{ .sp Drop T} .TE .sp 1 .RE .SS "Publish\-subscribe pattern" .sp The publish\-subscribe pattern is used for one\-to\-many distribution of data from a single \fIpublisher\fR to multiple \fIsubscribers\fR in a fan out fashion\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBXS_PUB\fR .RS 4 .sp A socket of type \fIXS_PUB\fR is used by a \fIpublisher\fR to distribute data\&. Messages sent are distributed in a fan out fashion to all connected peers\&. The \fBxs_recv\fR(3) function is not implemented for this socket type\&. .sp When a \fIXS_PUB\fR socket enters an exceptional state due to having reached the high water mark for a \fIsubscriber\fR, then any messages that would be sent to the \fIsubscriber\fR in question shall instead be dropped until the exceptional state ends\&. The \fIxs_send()\fR function shall never block for this socket type\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .B Table\ \&5.\ \&Summary of XS_PUB characteristics .TS tab(:); lt lt lt lt lt lt lt lt lt lt. T{ .sp Compatible peer sockets T}:T{ .sp \fIXS_SUB\fR, \fIXS_XSUB\fR T} T{ .sp Send/receive pattern T}:T{ .sp Send only T} T{ .sp Incoming routing strategy T}:T{ .sp N/A T} T{ .sp Outgoing routing strategy T}:T{ .sp Fan out T} T{ .sp XS_HWM option action T}:T{ .sp Drop T} .TE .sp 1 .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBXS_SUB\fR .RS 4 .sp A socket of type \fIXS_SUB\fR is used by a \fIsubscriber\fR to subscribe to data distributed by a \fIpublisher\fR\&. Initially a \fIXS_SUB\fR socket is not subscribed to any messages, use the \fIXS_SUBSCRIBE\fR option of \fBxs_setsockopt\fR(3) to specify which messages to subscribe to\&. The \fIxs_send()\fR function is not implemented for this socket type\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .B Table\ \&6.\ \&Summary of XS_SUB characteristics .TS tab(:); lt lt lt lt lt lt lt lt lt lt. T{ .sp Compatible peer sockets T}:T{ .sp \fIXS_PUB\fR, \fIXS_XPUB\fR T} T{ .sp Send/receive pattern T}:T{ .sp Receive only T} T{ .sp Incoming routing strategy T}:T{ .sp Fair\-queued T} T{ .sp Outgoing routing strategy T}:T{ .sp N/A T} T{ .sp XS_HWM option action T}:T{ .sp Drop T} .TE .sp 1 .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBXS_XPUB\fR .RS 4 .sp Same as XS_PUB except that you can receive subscriptions from the peers in form of incoming messages\&. Subscription message is a byte 1 (for subscriptions) or byte 0 (for unsubscriptions) followed by the subscription body\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .B Table\ \&7.\ \&Summary of XS_XPUB characteristics .TS tab(:); lt lt lt lt lt lt lt lt lt lt. T{ .sp Compatible peer sockets T}:T{ .sp \fIXS_SUB\fR, \fIXS_XSUB\fR T} T{ .sp Send/receive pattern T}:T{ .sp Send messages, receive subscriptions T} T{ .sp Incoming routing strategy T}:T{ .sp N/A T} T{ .sp Outgoing routing strategy T}:T{ .sp Fan out T} T{ .sp XS_HWM option action T}:T{ .sp Drop T} .TE .sp 1 .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBXS_XSUB\fR .RS 4 .sp Same as XS_SUB except that you subscribe by sending subscription messages to the socket\&. Subscription message is a byte 1 (for subscriptions) or byte 0 (for unsubscriptions) followed by the subscription body\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .B Table\ \&8.\ \&Summary of XS_XSUB characteristics .TS tab(:); lt lt lt lt lt lt lt lt lt lt. T{ .sp Compatible peer sockets T}:T{ .sp \fIXS_PUB\fR, \fIXS_XPUB\fR T} T{ .sp Send/receive pattern T}:T{ .sp Receive messages, send subscriptions T} T{ .sp Incoming routing strategy T}:T{ .sp Fair\-queued T} T{ .sp Outgoing routing strategy T}:T{ .sp N/A T} T{ .sp XS_HWM option action T}:T{ .sp Drop T} .TE .sp 1 .RE .SS "Pipeline pattern" .sp The pipeline pattern is used for distributing data to \fInodes\fR arranged in a pipeline\&. Data always flows down the pipeline, and each stage of the pipeline is connected to at least one \fInode\fR\&. When a pipeline stage is connected to multiple \fInodes\fR data is load\-balanced among all connected \fInodes\fR\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBXS_PUSH\fR .RS 4 .sp A socket of type \fIXS_PUSH\fR is used by a pipeline \fInode\fR to send messages to downstream pipeline \fInodes\fR\&. Messages are load\-balanced to all connected downstream \fInodes\fR\&. The \fIxs_recv()\fR function is not implemented for this socket type\&. .sp When a \fIXS_PUSH\fR socket enters an exceptional state due to having reached the high water mark for all downstream \fInodes\fR, or if there are no downstream \fInodes\fR at all, then any \fBxs_send\fR(3) operations on the socket shall block until the exceptional state ends or at least one downstream \fInode\fR becomes available for sending; messages are not discarded\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .B Table\ \&9.\ \&Summary of XS_PUSH characteristics .TS tab(:); lt lt lt lt lt lt lt lt lt lt lt lt. T{ .sp Compatible peer sockets T}:T{ .sp \fIXS_PULL\fR T} T{ .sp Direction T}:T{ .sp Unidirectional T} T{ .sp Send/receive pattern T}:T{ .sp Send only T} T{ .sp Incoming routing strategy T}:T{ .sp N/A T} T{ .sp Outgoing routing strategy T}:T{ .sp Load\-balanced T} T{ .sp XS_HWM option action T}:T{ .sp Block T} .TE .sp 1 .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBXS_PULL\fR .RS 4 .sp A socket of type \fIXS_PULL\fR is used by a pipeline \fInode\fR to receive messages from upstream pipeline \fInodes\fR\&. Messages are fair\-queued from among all connected upstream \fInodes\fR\&. The \fIxs_send()\fR function is not implemented for this socket type\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .B Table\ \&10.\ \&Summary of XS_PULL characteristics .TS tab(:); lt lt lt lt lt lt lt lt lt lt lt lt. T{ .sp Compatible peer sockets T}:T{ .sp \fIXS_PUSH\fR T} T{ .sp Direction T}:T{ .sp Unidirectional T} T{ .sp Send/receive pattern T}:T{ .sp Receive only T} T{ .sp Incoming routing strategy T}:T{ .sp Fair\-queued T} T{ .sp Outgoing routing strategy T}:T{ .sp N/A T} T{ .sp XS_HWM option action T}:T{ .sp N/A T} .TE .sp 1 .RE .SS "Survey pattern" .sp Survey pattern can be used to post a survey to a set of notes and collect responses from them\&. The survey is distributed from surveyor to all connected respondents\&. Responses are routed back to the original surveyor\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBXS_SURVEYOR\fR .RS 4 .sp XS_SURVEYOR socket type can be used to send surveys to all respondents in the topology and receive the replies from all of them\&. Each survey sent is distributed to all connected peers, and incoming replies are fair\-queue\&. As you don\(cqt know the number of respondents in the topology you don\(cqt know the number of responses you are going to get, therefore you should use XS_SURVEY_TIMEOUT socket option to set the deadline for the survey\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .B Table\ \&11.\ \&Summary of XS_SURVEYOR characteristics .TS tab(:); lt lt lt lt lt lt lt lt lt lt lt lt. T{ .sp Compatible peer sockets T}:T{ .sp \fIXS_RESPONDENT\fR, \fIXS_XRESPONDENT\fR T} T{ .sp Direction T}:T{ .sp Bidirectional T} T{ .sp Send/receive pattern T}:T{ .sp Send one message, receive many messages\&. T} T{ .sp Incoming routing strategy T}:T{ .sp Fair\-queued T} T{ .sp Outgoing routing strategy T}:T{ .sp Fan out T} T{ .sp XS_HWM option action T}:T{ .sp Drop T} .TE .sp 1 .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBXS_RESPONDENT\fR .RS 4 .sp This socket type receives surveys from surveyors and sends responses\&. Incoming surveys are fair\-queued\&. Outgoing responses are routed back to the original surveyor\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .B Table\ \&12.\ \&Summary of XS_RESPONDENT characteristics .TS tab(:); lt lt lt lt lt lt lt lt lt lt lt lt. T{ .sp Compatible peer sockets T}:T{ .sp \fIXS_SURVEYOR\fR, \fIXS_XSURVEYOR\fR T} T{ .sp Direction T}:T{ .sp Bidirectional T} T{ .sp Send/receive pattern T}:T{ .sp Receive a survey, send one response\&. T} T{ .sp Incoming routing strategy T}:T{ .sp Fair\-queued T} T{ .sp Outgoing routing strategy T}:T{ .sp Last peer T} T{ .sp XS_HWM option action T}:T{ .sp Drop T} .TE .sp 1 .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBXS_XSURVEYOR\fR .RS 4 .sp A socket of type \fIXS_XSURVEYOR\fR is a socket type underlying \fIXS_SURVEYOR\fR\&. It doesn\(cqt impose the strict order of sends and recvs as \fIXS_SURVEYOR\fR does and it is intended for use in intermediate devices in survey topologies\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .B Table\ \&13.\ \&Summary of XS_XSURVEYOR characteristics .TS tab(:); lt lt lt lt lt lt lt lt lt lt lt lt. T{ .sp Compatible peer sockets T}:T{ .sp \fIXS_RESPONDENT\fR, \fIXS_XRESPONDENT\fR T} T{ .sp Direction T}:T{ .sp Bidirectional T} T{ .sp Send/receive pattern T}:T{ .sp Send surveys, receive responses\&. T} T{ .sp Incoming routing strategy T}:T{ .sp Fair\-queued T} T{ .sp Outgoing routing strategy T}:T{ .sp Fan out T} T{ .sp XS_HWM option action T}:T{ .sp Drop T} .TE .sp 1 .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBXS_XRESPONDENT\fR .RS 4 .sp A socket of type \fIXS_XRESPONDENT\fR is a socket type underlying \fIXS_RESPONDENT\fR\&. It doesn\(cqt impose the strict order of sends and recvs as \fIXS_RESPONDENT\fR does and it is intended for use in intermediate devices in survey topologies\&. .sp Incoming surveys are fair\-queued\&. Each survey is prefixed by a message part identifying the surveyor it was received from\&. Outgoing responses are routed to the original surveyor based on the first message part\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .B Table\ \&14.\ \&Summary of XS_XRESPONDENT characteristics .TS tab(:); lt lt lt lt lt lt lt lt lt lt lt lt. T{ .sp Compatible peer sockets T}:T{ .sp \fIXS_SURVEYOR\fR, \fIXS_XSURVEYOR\fR T} T{ .sp Direction T}:T{ .sp Bidirectional T} T{ .sp Send/receive pattern T}:T{ .sp Receive surveys, send responses\&. T} T{ .sp Incoming routing strategy T}:T{ .sp Fair\-queued T} T{ .sp Outgoing routing strategy T}:T{ .sp See text T} T{ .sp XS_HWM option action T}:T{ .sp Drop T} .TE .sp 1 .RE .SS "Exclusive pair pattern" .sp The exclusive pair is an advanced pattern used for communicating exclusively between two peers\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBXS_PAIR\fR .RS 4 .sp A socket of type \fIXS_PAIR\fR can only be connected to a single peer at any one time\&. No message routing or filtering is performed on messages sent over a \fIXS_PAIR\fR socket\&. .sp When a \fIXS_PAIR\fR socket enters an exceptional state due to having reached the high water mark for the connected peer, or if no peer is connected, then any \fBxs_send\fR(3) operations on the socket shall block until the peer becomes available for sending; messages are not discarded\&. .if n \{\ .sp .\} .RS 4 .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBNote\fR .ps -1 .br .sp \fIXS_PAIR\fR sockets are experimental, and are currently missing several features such as auto\-reconnection\&. .sp .5v .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .B Table\ \&15.\ \&Summary of XS_PAIR characteristics .TS tab(:); lt lt lt lt lt lt lt lt lt lt lt lt. T{ .sp Compatible peer sockets T}:T{ .sp \fIXS_PAIR\fR T} T{ .sp Direction T}:T{ .sp Bidirectional T} T{ .sp Send/receive pattern T}:T{ .sp Unrestricted T} T{ .sp Incoming routing strategy T}:T{ .sp N/A T} T{ .sp Outgoing routing strategy T}:T{ .sp N/A T} T{ .sp XS_HWM option action T}:T{ .sp Block T} .TE .sp 1 .RE .SH "RETURN VALUE" .sp The \fIxs_socket()\fR function shall return an opaque handle to the newly created socket if successful\&. Otherwise, it shall return NULL and set \fIerrno\fR to one of the values defined below\&. .SH "ERRORS" .PP \fBEINVAL\fR .RS 4 The requested socket \fItype\fR is invalid\&. .RE .PP \fBEFAULT\fR .RS 4 The provided \fIcontext\fR is invalid\&. .RE .PP \fBEMFILE\fR .RS 4 The limit on the total number of open Crossroads sockets has been reached\&. .RE .PP \fBETERM\fR .RS 4 The context specified was terminated\&. .RE .SH "SEE ALSO" .sp \fBxs_init\fR(3) \fBxs_setsockopt\fR(3) \fBxs_bind\fR(3) \fBxs_connect\fR(3) \fBxs_send\fR(3) \fBxs_recv\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