sctp_send.3 (0add3200d178976b95848eff050d419cf4062520) | sctp_send.3 (d8b5fd91b9011a1c21b7389e2dade6b9b1f6e425) |
---|---|
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. --- 21 unchanged lines hidden (view full) --- 30.\" SUCH DAMAGE. 31.\" 32.\" $FreeBSD$ 33.\" 34.Dd December 15, 2006 35.Dt SCTP_SEND 3 36.Os 37.Sh NAME | 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. --- 21 unchanged lines hidden (view full) --- 30.\" SUCH DAMAGE. 31.\" 32.\" $FreeBSD$ 33.\" 34.Dd December 15, 2006 35.Dt SCTP_SEND 3 36.Os 37.Sh NAME |
38.Nm sctp_send , | 38.Nm sctp_send |
39.Nm sctp_sendx 40.Nd send a message from an SCTP socket 41.Sh LIBRARY 42.Lb libc 43.Sh SYNOPSIS 44.In sys/types.h 45.In sys/socket.h | 39.Nm sctp_sendx 40.Nd send a message from an SCTP socket 41.Sh LIBRARY 42.Lb libc 43.Sh SYNOPSIS 44.In sys/types.h 45.In sys/socket.h |
46.In netinet/sctp.h | 46.In sys/sctp.h |
47.Ft ssize_t | 47.Ft ssize_t |
48.Fo sctp_send 49.Fa "int sd" "const void *msg" "size_t len" 50.Fa "const struct sctp_sndrcvinfo *sinfo" "int flags" 51.Fc | 48.Fn sctp_send "int sd" "const void *msg" "size_t len" "const struct sctp_sndrcvinfo *sinfo" "int flags" |
52.Ft ssize_t | 49.Ft ssize_t |
53.Fo sctp_sendx 54.Fa "int sd" "const void *msg" "size_t len" "struct sockaddr *addrs" 55.Fa "int addrcnt" "const struct sctp_sndrcvinfo *sinfo" "int flags" 56.Fc | 50.Fn sctp_sendx "int sd" "const void *msg" "size_t len" "struct sockaddr *addrs" "int addrcnt" "const struct sctp_sndrcvinfo *sinfo" "int flags" |
57.Sh DESCRIPTION 58The 59.Fn sctp_send | 51.Sh DESCRIPTION 52The 53.Fn sctp_send |
60system call | 54system calls |
61is used to transmit a message to another SCTP endpoint. | 55is used to transmit a message to another SCTP endpoint. |
56The |
|
62.Fn sctp_send 63may be used to send data to an existing association for both 64one-to-many (SOCK_SEQPACKET) and one-to-one (SOCK_STREAM) socket types. 65The length of the message 66.Fa msg 67is given by 68.Fa len . 69If the message is too long to pass atomically through the | 57.Fn sctp_send 58may be used to send data to an existing association for both 59one-to-many (SOCK_SEQPACKET) and one-to-one (SOCK_STREAM) socket types. 60The length of the message 61.Fa msg 62is given by 63.Fa len . 64If the message is too long to pass atomically through the |
70underlying protocol, 71.Va errno 72is set to 73.Er EMSGSIZE , 74-1 is returned, and | 65underlying protocol, the errno is set to 66.Er EMSGSIZE 67a -1 is returned, and |
75the message is not transmitted. 76.Pp 77No indication of failure to deliver is implicit in a | 68the message is not transmitted. 69.Pp 70No indication of failure to deliver is implicit in a |
78.Fn sctp_send . | 71.Fn sctp_send |
79Locally detected errors are indicated by a return value of -1. 80.Pp | 72Locally detected errors are indicated by a return value of -1. 73.Pp |
81If no space is available at the socket to hold | 74If no messages space is available at the socket to hold |
82the message to be transmitted, then 83.Fn sctp_send 84normally blocks, unless the socket has been placed in 85non-blocking I/O mode. 86The | 75the message to be transmitted, then 76.Fn sctp_send 77normally blocks, unless the socket has been placed in 78non-blocking I/O mode. 79The |
87.Xr select 2 | 80.Fn select 2 |
88system call may be used to determine when it is possible to 89send more data on one-to-one type (SOCK_STREAM) sockets. 90.Pp 91The 92.Fa sinfo 93structure is used to control various SCTP features 94and has the following format: 95.Bd -literal --- 4 unchanged lines hidden (view full) --- 100 u_int32_t sinfo_ppid; /* ppid field */ 101 u_int32_t sinfo_context; /* context field */ 102 u_int32_t sinfo_timetolive; /* timetolive for PR-SCTP */ 103 u_int32_t sinfo_tsn; /* valid for recv only */ 104 u_int32_t sinfo_cumtsn; /* valid for recv only */ 105 sctp_assoc_t sinfo_assoc_id; /* The association id */ 106}; 107.Ed | 81system call may be used to determine when it is possible to 82send more data on one-to-one type (SOCK_STREAM) sockets. 83.Pp 84The 85.Fa sinfo 86structure is used to control various SCTP features 87and has the following format: 88.Bd -literal --- 4 unchanged lines hidden (view full) --- 93 u_int32_t sinfo_ppid; /* ppid field */ 94 u_int32_t sinfo_context; /* context field */ 95 u_int32_t sinfo_timetolive; /* timetolive for PR-SCTP */ 96 u_int32_t sinfo_tsn; /* valid for recv only */ 97 u_int32_t sinfo_cumtsn; /* valid for recv only */ 98 sctp_assoc_t sinfo_assoc_id; /* The association id */ 99}; 100.Ed |
108.Pp | |
109The 110.Fa sinfo->sinfo_ppid 111argument is an opaque 32 bit value that is passed transparently 112through the stack to the peer endpoint. It will be available on 113reception of a message (see | 101The 102.Fa sinfo->sinfo_ppid 103argument is an opaque 32 bit value that is passed transparently 104through the stack to the peer endpoint. It will be available on 105reception of a message (see |
114.Xr sctp_recvmsg 3 ) . 115Note that the stack passes this value without regard to byte | 106.Fn sctp_recvmsg 2 107). Note that the stack passes this value without regard to byte |
116order. 117.Pp 118The 119.Fa sinfo->sinfo_flags 120argument may include one or more of the following: 121.Bd -literal 122#define SCTP_EOF 0x0100 /* Start a shutdown procedures */ 123#define SCTP_ABORT 0x0200 /* Send an ABORT to peer */ --- 5 unchanged lines hidden (view full) --- 129#define SCTP_PR_SCTP_TTL 0x0001 /* Time based PR-SCTP */ 130#define SCTP_PR_SCTP_BUF 0x0002 /* Buffer based PR-SCTP */ 131#define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based PR-SCTP */ 132.Ed 133.Pp 134The flag 135.Dv SCTP_EOF 136is used to instruct the SCTP stack to queue this message | 108order. 109.Pp 110The 111.Fa sinfo->sinfo_flags 112argument may include one or more of the following: 113.Bd -literal 114#define SCTP_EOF 0x0100 /* Start a shutdown procedures */ 115#define SCTP_ABORT 0x0200 /* Send an ABORT to peer */ --- 5 unchanged lines hidden (view full) --- 121#define SCTP_PR_SCTP_TTL 0x0001 /* Time based PR-SCTP */ 122#define SCTP_PR_SCTP_BUF 0x0002 /* Buffer based PR-SCTP */ 123#define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based PR-SCTP */ 124.Ed 125.Pp 126The flag 127.Dv SCTP_EOF 128is used to instruct the SCTP stack to queue this message |
137and then start a graceful shutdown of the association. 138All | 129and then start a graceful shutdown of the association. All |
139remaining data in queue will be sent after which the association | 130remaining data in queue will be sent after which the association |
140will be shut down. | 131will be shutdown. |
141.Pp 142.Dv SCTP_ABORT | 132.Pp 133.Dv SCTP_ABORT |
143is used to immediately terminate an association. 144An abort | 134is used to immediately terminate an association. An abort |
145is sent to the peer and the local TCB is destroyed. 146.Pp 147.Dv SCTP_UNORDERED 148is used to specify that the message being sent has no 149specific order and should be delivered to the peer application | 135is sent to the peer and the local TCB is destroyed. 136.Pp 137.Dv SCTP_UNORDERED 138is used to specify that the message being sent has no 139specific order and should be delivered to the peer application |
150as soon as possible. 151When this flag is absent messages | 140as soon as possible. When this flag is absent messages |
152are delivered in order within the stream they are sent, but without 153respect to order to peer streams. 154.Pp 155The flag 156.Dv SCTP_ADDR_OVER | 141are delivered in order within the stream they are sent, but without 142respect to order to peer streams. 143.Pp 144The flag 145.Dv SCTP_ADDR_OVER |
157is used to specify that a specific address should be used. 158Normally 159SCTP will use only one of a multi-homed peers addresses as the primary 160address to send to. 161By default, no matter what the | 146is used to specify that an specific address should be used. Normally 147SCTP will use only one of a multi-homed peers address as the primary 148address to send to. By default, no matter what the |
162.Fa to | 149.Fa to |
163argument is, this primary address is used to send data. 164By specifying | 150argument is, this primary address is used to send data. By specifying |
165this flag, the user is asking the stack to ignore the primary address | 151this flag, the user is asking the stack to ignore the primary address |
166and instead use the specified address not only as a lookup mechanism 167to find the association but also as the actual address to send to. | 152and instead use the specified address not only has a lookup mechanism 153to find the association but also has the actual address to send to. |
168.Pp 169For a one-to-many type (SOCK_SEQPACKET) socket the flag 170.Dv SCTP_SENDALL | 154.Pp 155For a one-to-many type (SOCK_SEQPACKET) socket the flag 156.Dv SCTP_SENDALL |
171can be used as a convenient way to make one send call and have | 157can be used as a convient way to make one send call and have |
172all associations that are under the socket get a copy of the message. 173Note that this mechanism is quite efficent and makes only one actual 174copy of the data which is shared by all the associations for sending. 175.Pp | 158all associations that are under the socket get a copy of the message. 159Note that this mechanism is quite efficent and makes only one actual 160copy of the data which is shared by all the associations for sending. 161.Pp |
176The remaining flags are used for the partial reliability extension (RFC3758) | 162The remaining flags are used for the partial reliabilty extension (RFC3758) |
177and will only be effective if the peer endpoint supports this extension. | 163and will only be effective if the peer endpoint supports this extension. |
178This option specifies what local policy the local endpoint should use 179in skipping data. 180If none of these options are set, then data is | 164This option specify's what local policy the local endpoint should use 165in skipping data. If none of these options are set, then data is |
181never skipped over. 182.Pp 183.Dv SCTP_PR_SCTP_TTL | 166never skipped over. 167.Pp 168.Dv SCTP_PR_SCTP_TTL |
184is used to indicate that a time based lifetime is being applied 185to the data. 186The | 169Is used to indicate that a time based lifetime is being applied 170to the data. The |
187.Fa sinfo->sinfo_timetolive 188argument is then a number of milliseconds for which the data is | 171.Fa sinfo->sinfo_timetolive 172argument is then a number of milliseconds for which the data is |
189attempted to be transmitted. 190If that many milliseconds ellapse 191and the peer has not acknowledged the data, the data will be 192skipped and no longer transmitted. 193Note that this policy does 194not even assure that the data will ever be sent. 195In times of a congestion | 173attempted to be transmitted. If that many milliseconds ellapses 174and the peer has not acknowledge the data, the data will be 175skipped and no longer transmitted. Note that this policy does 176not even assure that the data will ever be sent. In times of a congestion |
196with large amounts of data being queued, the 197.Fa sinfo->sinfo_timetolive 198may expire before the first transmission is ever made. 199.Pp 200The 201.Dv SCTP_PR_SCTP_BUF 202based policy transforms the 203.Fa sinfo->sinfo_timetolive 204field into a total number of bytes allowed on the outbound | 177with large amounts of data being queued, the 178.Fa sinfo->sinfo_timetolive 179may expire before the first transmission is ever made. 180.Pp 181The 182.Dv SCTP_PR_SCTP_BUF 183based policy transforms the 184.Fa sinfo->sinfo_timetolive 185field into a total number of bytes allowed on the outbound |
205send queue. 206If that number or more bytes are in queue, then 207other buffer-based sends are looked to be removed and 208skipped. 209Note that this policy may also result in the data | 186send queue. If that number or more bytes are in queue, then 187other buffer based sends are looked to be removed and 188skipped. Note that this policy may also result in the data |
210never being sent if no buffer based sends are in queue and 211the maximum specified by 212.Fa timetolive 213bytes is in queue. 214.Pp 215The 216.Dv SCTP_PR_SCTP_RTX 217policy transforms the 218.Fa sinfo->sinfo_timetolive | 189never being sent if no buffer based sends are in queue and 190the maximum specified by 191.Fa timetolive 192bytes is in queue. 193.Pp 194The 195.Dv SCTP_PR_SCTP_RTX 196policy transforms the 197.Fa sinfo->sinfo_timetolive |
219into a number of retransmissions to allow. 220This policy | 198into a number of retransmissions to allow. This policy |
221always assures that at a minimum one send attempt is | 199always assures that at a minimum one send attempt is |
222made of the data. 223After which no more than | 200made of the data. After which no more than |
224.Fa sinfo->sinfo_timetolive 225retransmissions will be made before the data is skipped. 226.Pp 227.Fa sinfo->sinfo_stream 228is the SCTP stream that you wish to send the | 201.Fa sinfo->sinfo_timetolive 202retransmissions will be made before the data is skipped. 203.Pp 204.Fa sinfo->sinfo_stream 205is the SCTP stream that you wish to send the |
229message on. 230Streams in SCTP are reliable (or partially reliable) flows of ordered | 206message on. Streams in SCTP are reliable (or partially reliable) flows of ordered |
231messages. 232.Pp 233The 234.Fa sinfo->sinfo_assoc_id 235field is used to | 207messages. 208.Pp 209The 210.Fa sinfo->sinfo_assoc_id 211field is used to |
236select the association to send to on a one-to-many socket. 237For a one-to-one socket, this field is ignored. | 212select the association to send to on an one-to-many socket. For a 213one-to-one socket, this field is ignored. |
238.Pp | 214.Pp |
239The | |
240.Fa sinfo->sinfo_context | 215.Fa sinfo->sinfo_context |
241field is used only in the event the message cannot be sent. 242This is an opaque | 216field is used only in the event the message cannot be sent. This is an opaque |
243value that the stack retains and will give to the user when a failed send 244is given if that notification is enabled (see | 217value that the stack retains and will give to the user when a failed send 218is given if that notification is enabled (see |
245.Xr sctp 4 ) . 246Normally a user process can use this value to index some application | 219.Tn sctp 220). Normally a user process can use this value to index some application |
247specific data structure when a send cannot be fulfilled. 248.Pp 249The 250.Fa flags | 221specific data structure when a send cannot be fulfilled. 222.Pp 223The 224.Fa flags |
251argument holds the same meaning and values as those found in 252.Xr sendmsg 2 | 225argument holds the same meaning and values has those found in 226.Fn sendmsg 2 |
253but is generally ignored by SCTP. 254.Pp 255The fields 256.Fa sinfo->sinfo_ssn , 257.Fa sinfo->sinfo_tsn , 258and 259.Fa sinfo->sinfo_cumtsn 260are used only when receiving messages and are thus ignored by | 227but is generally ignored by SCTP. 228.Pp 229The fields 230.Fa sinfo->sinfo_ssn , 231.Fa sinfo->sinfo_tsn , 232and 233.Fa sinfo->sinfo_cumtsn 234are used only when receiving messages and are thus ignored by |
261.Fn sctp_send . | 235.Fn sctp_send. |
262The function 263.Fn sctp_sendx 264has the same properties as 265.Fn sctp_send 266with the additional arguments of an array of sockaddr structures | 236The function 237.Fn sctp_sendx 238has the same properties as 239.Fn sctp_send 240with the additional arguments of an array of sockaddr structures |
267passed in. 268With the | 241passed in. With the |
269.Fa addrs 270argument being given as an array of addresses to be sent to and 271the 272.Fa addrcnt 273argument indicating how many socket addresses are in the passed | 242.Fa addrs 243argument being given as an array of addresses to be sent to and 244the 245.Fa addrcnt 246argument indicating how many socket addresses are in the passed |
274in array. 275Note that all of the addresses will only be used 276when an implicit association is being set up. 277This allows the 278user the equivalent behavior as doing a | 247in array. Note that all of the addresses will only be used 248when an implicit association is being setup. This allows the 249user the equivilant behavior as doing a |
279.Fn sctp_connectx 280followed by a 281.Fn sctp_send | 250.Fn sctp_connectx 251followed by a 252.Fn sctp_send |
282to the association. 283Note that if the | 253to the association. Note that if the association id. |
284.Fa sinfo->sinfo_assoc_id 285field is 0, then the first address will be used to look up | 254.Fa sinfo->sinfo_assoc_id 255field is 0, then the first address will be used to look up |
286the association in place of the association id. 287If both 288an address and an association id are specified, the association 289id has priority. | 256the association in place of the association id. If both 257an address and and association id are specified, the association 258id has priority. |
290.Sh RETURN VALUES 291The call returns the number of characters sent, or -1 292if an error occurred. 293.Sh ERRORS 294The 295.Fn sctp_send 296system call | 259.Sh RETURN VALUES 260The call returns the number of characters sent, or -1 261if an error occurred. 262.Sh ERRORS 263The 264.Fn sctp_send 265system call |
297fails if: | 266fail if: |
298.Bl -tag -width Er 299.It Bq Er EBADF 300An invalid descriptor was specified. 301.It Bq Er ENOTSOCK 302The argument 303.Fa s 304is not a socket. 305.It Bq Er EFAULT --- 8 unchanged lines hidden (view full) --- 314The system was unable to allocate an internal buffer. 315The operation may succeed when buffers become available. 316.It Bq Er ENOBUFS 317The output queue for a network interface was full. 318This generally indicates that the interface has stopped sending, 319but may be caused by transient congestion. 320.It Bq Er EHOSTUNREACH 321The remote host was unreachable. | 267.Bl -tag -width Er 268.It Bq Er EBADF 269An invalid descriptor was specified. 270.It Bq Er ENOTSOCK 271The argument 272.Fa s 273is not a socket. 274.It Bq Er EFAULT --- 8 unchanged lines hidden (view full) --- 283The system was unable to allocate an internal buffer. 284The operation may succeed when buffers become available. 285.It Bq Er ENOBUFS 286The output queue for a network interface was full. 287This generally indicates that the interface has stopped sending, 288but may be caused by transient congestion. 289.It Bq Er EHOSTUNREACH 290The remote host was unreachable. |
322.It Bq Er ENOTCONN 323On a one-to-one style socket no association exists. | 291.It Bq Er ENOTCON 292On a one to one style socket no association exists. |
324.It Bq Er ECONNRESET 325An abort was received by the stack while the user was 326attempting to send data to the peer. 327.It Bq Er ENOENT | 293.It Bq Er ECONNRESET 294An abort was received by the stack while the user was 295attempting to send data to the peer. 296.It Bq Er ENOENT |
328On a one-to-many style socket no address is specified | 297On a one to many style socket no address is specified |
329so that the association cannot be located or the 330SCTP_ABORT flag was specified on a non-existing association. 331.It Bq Er EPIPE 332The socket is unable to send anymore data 333.Dv ( SBS_CANTSENDMORE 334has been set on the socket). 335This typically means that the socket 336is not connected and is a one-to-one style socket. 337.El 338.Sh SEE ALSO | 298so that the association cannot be located or the 299SCTP_ABORT flag was specified on a non-existing association. 300.It Bq Er EPIPE 301The socket is unable to send anymore data 302.Dv ( SBS_CANTSENDMORE 303has been set on the socket). 304This typically means that the socket 305is not connected and is a one-to-one style socket. 306.El 307.Sh SEE ALSO |
308.Xr sctp 4 , 309.Xr sendmsg 2 , 310.Xr sctp_sendmsg 3 , 311.Xr sctp_recvmsg 3 , 312.Xr sctp_connectx 3 , |
|
339.Xr getsockopt 2 , 340.Xr recv 2 , 341.Xr select 2 , | 313.Xr getsockopt 2 , 314.Xr recv 2 , 315.Xr select 2 , |
342.Xr sendmsg 2 , | |
343.Xr socket 2 , 344.Xr write 2 | 316.Xr socket 2 , 317.Xr write 2 |
345.Xr sctp_connectx 3 , 346.Xr sctp_recvmsg 3 , 347.Xr sctp_sendmsg 3 , 348.Xr sctp 4 | |
349.Sh BUGS 350Because 351.Fn sctp_send 352may have multiple associations under one endpoint, a 353select on write will only work for a one-to-one style 354socket. | 318.Sh BUGS 319Because 320.Fn sctp_send 321may have multiple associations under one endpoint, a 322select on write will only work for a one-to-one style 323socket. |
324 |
|