5331 want sockaddr(3SOCKET)
[illumos-gate.git] / usr / src / man / man3socket / sctp_recvmsg.3socket
blob875afc67145ef914321ae11ebabf6f1fa17f56d2
1 '\" te
2 .\" Copyright (c) 2004, Sun Microsystems, Inc.
3 .\" All Rights Reserved.
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH SCTP_RECVMSG 3SOCKET "Jul 14, 2004"
8 .SH NAME
9 sctp_recvmsg \- receive message from an SCTP socket
10 .SH SYNOPSIS
11 .LP
12 .nf
13 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lsocket\fR \fB -lnsl \fR \fB -lsctp \fR [ \fIlibrary\fR... ]
14 #include <sys/types.h>
15 #include <sys/socket.h>
16 #include <netinet/sctp.h>
18 \fBssize_t\fR \fBsctp_recvmsg\fR(\fBint\fR \fIs\fR, \fBvoid *\fR\fImsg\fR, \fBsize_t\fR \fIlen\fR, \fBstruct sockaddr *\fR\fIfrom\fR,
19      \fBsocklen_t *\fR\fIfromlen\fR, \fBstruct sctp_sndrcvinfo *\fR\fIsinfo\fR, \fBint *\fR\fImsg_flags\fR);
20 .fi
22 .SH DESCRIPTION
23 .LP
24 The \fBsctp_recvmsg()\fR function receives a message from the SCTP endpoint
25 \fIs\fR.
26 .sp
27 .LP
28 In addition to specifying the message buffer \fImsg\fR and the length \fIlen\fR
29 of the buffer, the following parameters can be set:
30 .sp
31 .ne 2
32 .na
33 \fB\fIfrom\fR\fR
34 .ad
35 .RS 13n
36 Pointer to an address, filled in with the sender's address
37 .RE
39 .sp
40 .ne 2
41 .na
42 \fB\fIfromlen\fR\fR
43 .ad
44 .RS 13n
45 Size of the buffer associated with the \fIfrom\fR parameter
46 .RE
48 .sp
49 .ne 2
50 .na
51 \fB\fIsinfo\fR\fR
52 .ad
53 .RS 13n
54 Pointer to an \fBsctp_sndrcvinfo\fR structure, filled in upon the receipt of
55 the message
56 .RE
58 .sp
59 .ne 2
60 .na
61 \fB\fImsg_flags\fR\fR
62 .ad
63 .RS 13n
64 Message flags such as \fBMSG_CTRUNC\fR, \fBMSG_NOTIFICATION\fR, \fBMSG_EOR\fR
65 .RE
67 .sp
68 .LP
69 The \fIsinfo\fR parameter is filled in only when the caller has enabled
70 \fBsctp_data_io_events\fR by calling \fBsetsockopt()\fR with the socket option
71 \fBSCTP_EVENTS\fR.
72 .SH RETURN VALUES
73 .LP
74 Upon successful completion, the \fBsctp_recvmsg()\fR function returns the
75 number of bytes received. The function returns \fB-1\fR if an error occurs.
76 .SH ERRORS
77 .LP
78 The \fBsctp_recvmsg()\fR function fails under the following conditions.
79 .sp
80 .ne 2
81 .na
82 \fB\fBEBADF\fR\fR
83 .ad
84 .RS 14n
85 The \fIs\fR argument is an invalid file descriptor.
86 .RE
88 .sp
89 .ne 2
90 .na
91 \fB\fBENOTSOCK\fR\fR
92 .ad
93 .RS 14n
94 The \fIs\fR argument is not a socket.
95 .RE
97 .sp
98 .ne 2
99 .na
100 \fB\fBEOPNOTSUPP\fR\fR
102 .RS 14n
103 \fBMSG_OOB\fR is set as a flag.
107 .ne 2
109 \fB\fBENOTCONN\fR\fR
111 .RS 14n
112 There is no established association.
115 .SH ATTRIBUTES
117 See \fBattributes\fR(5) for descriptions of the following attributes:
122 box;
123 c | c
124 l | l .
125 ATTRIBUTE TYPE  ATTRIBUTE VALUE
127 Interface Stability     Evolving
129 MT-Level        Safe
132 .SH SEE ALSO
134 \fBaccept\fR(3SOCKET), \fBbind\fR(3SOCKET), \fBconnect\fR(3SOCKET),
135 \fBin.h\fR(3HEAD), \fBlibsctp\fR(3LIB), \fBlisten\fR(3SOCKET),
136 \fBrecvmsg\fR(3SOCKET), \fBsctp_opt_info\fR(3SOCKET), \fBsetsockopt\fR(3SOCKET),
137 \fBsockaddr\fR(3SOCKET), \fBsocket\fR(3SOCKET), \fBsocket.h\fR(3HEAD),
138 \fBsctp\fR(7P)