sctp_sendmsg.3 (212463) | sctp_sendmsg.3 (233648) |
---|---|
1.\" Copyright (c) 1983, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 16 unchanged lines hidden (view full) --- 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" From: @(#)send.2 8.2 (Berkeley) 2/21/94 | 1.\" Copyright (c) 1983, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 16 unchanged lines hidden (view full) --- 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" From: @(#)send.2 8.2 (Berkeley) 2/21/94 |
33.\" $FreeBSD: head/lib/libc/net/sctp_sendmsg.3 212463 2010-09-11 10:49:56Z brucec $ | 33.\" $FreeBSD: head/lib/libc/net/sctp_sendmsg.3 233648 2012-03-29 05:02:12Z eadler $ |
34.\" 35.Dd December 15, 2006 36.Dt SCTP_SENDMSG 3 37.Os 38.Sh NAME 39.Nm sctp_sendmsg , 40.Nm sctp_sendmsgx 41.Nd send a message from an SCTP socket --- 25 unchanged lines hidden (view full) --- 67may be used at any time. 68If the socket is a one-to-many type (SOCK_SEQPACKET) 69socket then an attempt to send to an address that no association exists to will 70implicitly create a new association. 71Data sent in such an instance will result in 72the data being sent on the third leg of the SCTP four-way handshake. 73Note that if 74the socket is a one-to-one type (SOCK_STREAM) socket then an association must | 34.\" 35.Dd December 15, 2006 36.Dt SCTP_SENDMSG 3 37.Os 38.Sh NAME 39.Nm sctp_sendmsg , 40.Nm sctp_sendmsgx 41.Nd send a message from an SCTP socket --- 25 unchanged lines hidden (view full) --- 67may be used at any time. 68If the socket is a one-to-many type (SOCK_SEQPACKET) 69socket then an attempt to send to an address that no association exists to will 70implicitly create a new association. 71Data sent in such an instance will result in 72the data being sent on the third leg of the SCTP four-way handshake. 73Note that if 74the socket is a one-to-one type (SOCK_STREAM) socket then an association must |
75be in existence (by use of the | 75be in existence (by use of the |
76.Xr connect 2 77system call). | 76.Xr connect 2 77system call). |
78Calling | 78Calling |
79.Fn sctp_sendmsg 80or 81.Fn sctp_sendmsgx 82on a non-connected one-to-one socket will result in 83.Va errno 84being set to 85.Er ENOTCONN , 86-1 being returned, and the message not being transmitted. 87.Pp 88The address of the target is given by 89.Fa to 90with 91.Fa tolen 92specifying its size. | 79.Fn sctp_sendmsg 80or 81.Fn sctp_sendmsgx 82on a non-connected one-to-one socket will result in 83.Va errno 84being set to 85.Er ENOTCONN , 86-1 being returned, and the message not being transmitted. 87.Pp 88The address of the target is given by 89.Fa to 90with 91.Fa tolen 92specifying its size. |
93The length of the message | 93The length of the message |
94.Fa msg 95is given by 96.Fa len . 97If the message is too long to pass atomically through the 98underlying protocol, 99.Va errno | 94.Fa msg 95is given by 96.Fa len . 97If the message is too long to pass atomically through the 98underlying protocol, 99.Va errno |
100is set to | 100is set to |
101.Er EMSGSIZE , 102-1 is returned, and 103the message is not transmitted. 104.Pp 105No indication of failure to deliver is implicit in a 106.Xr sctp_sendmsg 3 107call. 108Locally detected errors are indicated by a return value of -1. 109.Pp 110If no space is available at the socket to hold 111the message to be transmitted, then 112.Xr sctp_sendmsg 3 113normally blocks, unless the socket has been placed in 114non-blocking I/O mode. 115The 116.Xr select 2 117system call may be used to determine when it is possible to 118send more data on one-to-one type (SOCK_STREAM) sockets. 119.Pp | 101.Er EMSGSIZE , 102-1 is returned, and 103the message is not transmitted. 104.Pp 105No indication of failure to deliver is implicit in a 106.Xr sctp_sendmsg 3 107call. 108Locally detected errors are indicated by a return value of -1. 109.Pp 110If no space is available at the socket to hold 111the message to be transmitted, then 112.Xr sctp_sendmsg 3 113normally blocks, unless the socket has been placed in 114non-blocking I/O mode. 115The 116.Xr select 2 117system call may be used to determine when it is possible to 118send more data on one-to-one type (SOCK_STREAM) sockets. 119.Pp |
120The | 120The |
121.Fa ppid 122argument is an opaque 32 bit value that is passed transparently 123through the stack to the peer endpoint. 124It will be available on 125reception of a message (see 126.Xr sctp_recvmsg 3 ) . 127Note that the stack passes this value without regard to byte 128order. --- 9 unchanged lines hidden (view full) --- 138#define SCTP_SENDALL 0x1000 /* Send this on all associations */ 139 /* for the endpoint */ 140/* The lower byte is an enumeration of PR-SCTP policies */ 141#define SCTP_PR_SCTP_TTL 0x0001 /* Time based PR-SCTP */ 142#define SCTP_PR_SCTP_BUF 0x0002 /* Buffer based PR-SCTP */ 143#define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based PR-SCTP */ 144.Ed 145.Pp | 121.Fa ppid 122argument is an opaque 32 bit value that is passed transparently 123through the stack to the peer endpoint. 124It will be available on 125reception of a message (see 126.Xr sctp_recvmsg 3 ) . 127Note that the stack passes this value without regard to byte 128order. --- 9 unchanged lines hidden (view full) --- 138#define SCTP_SENDALL 0x1000 /* Send this on all associations */ 139 /* for the endpoint */ 140/* The lower byte is an enumeration of PR-SCTP policies */ 141#define SCTP_PR_SCTP_TTL 0x0001 /* Time based PR-SCTP */ 142#define SCTP_PR_SCTP_BUF 0x0002 /* Buffer based PR-SCTP */ 143#define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based PR-SCTP */ 144.Ed 145.Pp |
146The flag | 146The flag |
147.Dv SCTP_EOF 148is used to instruct the SCTP stack to queue this message 149and then start a graceful shutdown of the association. 150All 151remaining data in queue will be sent after which the association 152will be shut down. 153.Pp 154.Dv SCTP_ABORT --- 10 unchanged lines hidden (view full) --- 165respect to order to peer streams. 166.Pp 167The flag 168.Dv SCTP_ADDR_OVER 169is used to specify that an specific address should be used. 170Normally 171SCTP will use only one of a multi-homed peers addresses as the primary 172address to send to. | 147.Dv SCTP_EOF 148is used to instruct the SCTP stack to queue this message 149and then start a graceful shutdown of the association. 150All 151remaining data in queue will be sent after which the association 152will be shut down. 153.Pp 154.Dv SCTP_ABORT --- 10 unchanged lines hidden (view full) --- 165respect to order to peer streams. 166.Pp 167The flag 168.Dv SCTP_ADDR_OVER 169is used to specify that an specific address should be used. 170Normally 171SCTP will use only one of a multi-homed peers addresses as the primary 172address to send to. |
173By default, no matter what the | 173By default, no matter what the |
174.Fa to 175argument is, this primary address is used to send data. 176By specifying 177this flag, the user is asking the stack to ignore the primary address 178and instead use the specified address not only as a lookup mechanism 179to find the association but also as the actual address to send to. 180.Pp 181For a one-to-many type (SOCK_SEQPACKET) socket the flag --- 18 unchanged lines hidden (view full) --- 200argument is then a number of milliseconds for which the data is 201attempted to be transmitted. 202If that many milliseconds elapse 203and the peer has not acknowledged the data, the data will be 204skipped and no longer transmitted. 205Note that this policy does 206not even assure that the data will ever be sent. 207In times of a congestion | 174.Fa to 175argument is, this primary address is used to send data. 176By specifying 177this flag, the user is asking the stack to ignore the primary address 178and instead use the specified address not only as a lookup mechanism 179to find the association but also as the actual address to send to. 180.Pp 181For a one-to-many type (SOCK_SEQPACKET) socket the flag --- 18 unchanged lines hidden (view full) --- 200argument is then a number of milliseconds for which the data is 201attempted to be transmitted. 202If that many milliseconds elapse 203and the peer has not acknowledged the data, the data will be 204skipped and no longer transmitted. 205Note that this policy does 206not even assure that the data will ever be sent. 207In times of a congestion |
208with large amounts of data being queued, the | 208with large amounts of data being queued, the |
209.Fa timetolive 210may expire before the first transmission is ever made. 211.Pp 212The 213.Dv SCTP_PR_SCTP_BUF 214based policy transforms the | 209.Fa timetolive 210may expire before the first transmission is ever made. 211.Pp 212The 213.Dv SCTP_PR_SCTP_BUF 214based policy transforms the |
215.Fa timetolive | 215.Fa timetolive |
216field into a total number of bytes allowed on the outbound 217send queue. 218If that number or more bytes are in queue, then 219other buffer based sends are looked to be removed and 220skipped. 221Note that this policy may also result in the data 222never being sent if no buffer based sends are in queue and | 216field into a total number of bytes allowed on the outbound 217send queue. 218If that number or more bytes are in queue, then 219other buffer based sends are looked to be removed and 220skipped. 221Note that this policy may also result in the data 222never being sent if no buffer based sends are in queue and |
223the maximum specified by 224.Fa timetolive | 223the maximum specified by 224.Fa timetolive |
225bytes is in queue. 226.Pp 227The 228.Dv SCTP_PR_SCTP_RTX 229policy transforms the | 225bytes is in queue. 226.Pp 227The 228.Dv SCTP_PR_SCTP_RTX 229policy transforms the |
230.Fa timetolive | 230.Fa timetolive |
231into a number of retransmissions to allow. 232This policy 233always assures that at a minimum one send attempt is 234made of the data. | 231into a number of retransmissions to allow. 232This policy 233always assures that at a minimum one send attempt is 234made of the data. |
235After which no more than | 235After which no more than |
236.Fa timetolive 237retransmissions will be made before the data is skipped. 238.Pp 239.Fa stream_no 240is the SCTP stream that you wish to send the 241message on. 242Streams in SCTP are reliable (or partially reliable) flows of ordered 243messages. | 236.Fa timetolive 237retransmissions will be made before the data is skipped. 238.Pp 239.Fa stream_no 240is the SCTP stream that you wish to send the 241message on. 242Streams in SCTP are reliable (or partially reliable) flows of ordered 243messages. |
244The | 244The |
245.Fa context 246field is used only in the event the message cannot be sent. 247This is an opaque 248value that the stack retains and will give to the user when a failed send 249is given if that notification is enabled (see 250.Xr sctp 4 ) . 251Normally a user process can use this value to index some application 252specific data structure when a send cannot be fulfilled. 253.Fn sctp_sendmsgx | 245.Fa context 246field is used only in the event the message cannot be sent. 247This is an opaque 248value that the stack retains and will give to the user when a failed send 249is given if that notification is enabled (see 250.Xr sctp 4 ) . 251Normally a user process can use this value to index some application 252specific data structure when a send cannot be fulfilled. 253.Fn sctp_sendmsgx |
254is identical to | 254is identical to |
255.Fn sctp_sendmsg 256with the exception that it takes an array of sockaddr structures in the 257argument 258.Fa to 259and adds the additional argument 260.Fa addrcnt 261which specifies how many addresses are in the array. 262This allows a 263caller to implicitly set up an association passing multiple addresses 264as if | 255.Fn sctp_sendmsg 256with the exception that it takes an array of sockaddr structures in the 257argument 258.Fa to 259and adds the additional argument 260.Fa addrcnt 261which specifies how many addresses are in the array. 262This allows a 263caller to implicitly set up an association passing multiple addresses 264as if |
265.Fn sctp_connectx | 265.Fn sctp_connectx |
266had been called to set up the association. 267.Sh RETURN VALUES 268The call returns the number of characters sent, or -1 269if an error occurred. 270.Sh ERRORS 271The 272.Fn sctp_sendmsg 273system call --- 46 unchanged lines hidden (view full) --- 320.Xr select 2 , 321.Xr socket 2 , 322.Xr write 2 , 323.Xr sctp_connectx 3 , 324.Xr sendmsg 3 , 325.Xr sctp 4 326.Sh BUGS 327Because in the one-to-many style socket | 266had been called to set up the association. 267.Sh RETURN VALUES 268The call returns the number of characters sent, or -1 269if an error occurred. 270.Sh ERRORS 271The 272.Fn sctp_sendmsg 273system call --- 46 unchanged lines hidden (view full) --- 320.Xr select 2 , 321.Xr socket 2 , 322.Xr write 2 , 323.Xr sctp_connectx 3 , 324.Xr sendmsg 3 , 325.Xr sctp 4 326.Sh BUGS 327Because in the one-to-many style socket |
328.Fn sctp_sendmsg | 328.Fn sctp_sendmsg |
329or 330.Fn sctp_sendmsgx 331may have multiple associations under one endpoint, a 332select on write will only work for a one-to-one style 333socket. | 329or 330.Fn sctp_sendmsgx 331may have multiple associations under one endpoint, a 332select on write will only work for a one-to-one style 333socket. |