📄 sendto.3.man
字号:
'\" rtp.\" -*- nroff -*- vim: ft=nroff noautoindent nocindent nosmartindent.\".\" @(#) sendto.3.man,v 1.1.2.1 2004/05/16 02:35:35 brian Exp.\".\" =========================================================================.\".\" Copyright (C) 2001-2004 OpenSS7 Corporation <www.openss7.com>.\".\" All Rights Reserved..\".\" Permission is granted to make and distribute verbatim copies of this.\" manual provided the copyright notice and this permission notice are.\" preserved on all copies..\".\" Permission is granted to copy and distribute modified versions of this.\" manual under the conditions for verbatim copying, provided that the.\" entire resulting derived work is distributed under the terms of a.\" permission notice identical to this one.\" .\" Since the Linux kernel and libraries are constantly changing, this.\" manual page may be incorrect or out-of-date. The author(s) assume no.\" responsibility for errors or omissions, or for damages resulting from.\" the use of the information contained herein. The author(s) may not.\" have taken the same level of care in the production of this manual,.\" which is licensed free of charge, as they might when working.\" professionally..\" .\" Formatted or processed versions of this manual, if unaccompanied by.\" the source, must acknowledge the copyright and authors of this work..\".\" -------------------------------------------------------------------------.\".\" U.S. GOVERNMENT RESTRICTED RIGHTS. If you are licensing this Software.\" on behalf of the U.S. Government ("Government"), the following.\" provisions apply to you. If the Software is supplied by the Department.\" of Defense ("DoD"), it is classified as "Commercial Computer Software".\" under paragraph 252.227-7014 of the DoD Supplement to the Federal.\" Acquisition Regulations ("DFARS") (or any successor regulations) and the.\" Government is acquiring only the license rights granted herein (the.\" license rights customarily provided to non-Government users). If the.\" Software is supplied to any unit or agency of the Government other than.\" DoD, it is classified as "Restricted Computer Software" and the.\" Government's rights in the Software are defined in paragraph 52.227-19.\" of the Federal Acquisition Regulations ("FAR") (or any success.\" regulations) or, in the cases of NASA, in paragraph 18.52.227-86 of the.\" NASA Supplement to the FAR (or any successor regulations)..\".\" =========================================================================.\" .\" Commercial licensing and support of this software is available from.\" OpenSS7 Corporation at a fee. See http://www.openss7.com/.\" .\" =========================================================================.\".\" Last Modified 2004/05/16 02:35:35 by brian.\".\" =========================================================================.so strxnet.macros.R1bracket-label "\fR[\fB" "\fR]" "\fR, \fB"no-default-databasedatabase strxnet.refsaccumulatemove-punctuationabbreviate Ajoin-authors ", " ", " " and "et-al " et al" 2 3abbreviate-label-ranges ".."sort-adjacent-labels.R2.\".\".\".\".TH SENDTO 3 "2004/05/16 02:35:35" "strxnet-0_9_2-4" "Linux Fast-STREAMS Sockets Library".SH NAME.B sendto\- send a message on a socket.SH SYNOPSIS.PP.B #include <sys/socket.h>.HP.BI "ssize_t sendto(int " socket ", const void *" message ", size_t " length ", int " flags ", const struct sockaddr *" dest_addr ", socklen_t " dest_len );.SH DESCRIPTION.PPThe.BR sendto ()function sends a message through a connection-mode orconnectionless-mode socket. If the socket is connectionless-mode,the message will be sent to the address specified by.IR dest_addr .Ifthe socket is connection-mode,.I dest_addris ignored..PPThe function takes the following arguments:.TP.I socketSpecifies the socket file descriptor..TP.I messagePoints to a buffer containing the message to be sent..TP.I lengthSpecifies the size of the message in bytes..TP.I flagsSpecifies the type of message transmission. Values of thisargument are formed by logically OR'ing zero or more of thefollowing flags:.RS.TP.B MSG_EORTerminates a record (if supported by the protocol).TP.B MSG_OOBSends out-of-band data on sockets that support out-of-banddata. The significance and semantics of out-of-band dataare protocol-specific..RE.TP.I dest_addrPoints to a.B sockaddrstructure containing the destinationaddress. The length and format of the address depend on theaddress family of the socket..TP.I dest_lenSpecifies the length of the.B sockaddrstructure pointed to bythe.I dest_addrargument..PPIf the socket protocol supports broadcast and the specified addressis a broadcast address for the socket protocol,.BR sendto ()will failif the.B SO_BROADCASToption is not set for the socket..PPThe.I dest_addrargument specifies the address of the target. Thelength argument specifies the length of the message..PPSuccessful completion of a call to.BR sendto ()does not guaranteedelivery of the message. A return value of -1 indicates onlylocally-detected errors..PPIf space is not available at the sending socket to hold the messageto be transmitted and the socket file descriptor does not have.B O_NONBLOCKset,.BR sendto ()blocks until space is available. If spaceis not available at the sending socket to hold the message to betransmitted and the socket file descriptor does have.B O_NONBLOCKset,.BR sendto ()will fail..PPThe socket in use may require the process to have appropriateprivileges to use the.BR sendto ()function..SH NOTES.PPThe.BR select (2)and.BR poll (2)functions can be used to determinewhen it is possible to send more data..SH CAVEATS.PPThis system call is implemented as a.B SIOCSOCKSYSIOCTL. See.BR socksys (4)for more information..SH "RETURN VALUE".PPUpon successful completion,.BR sendto ()returns the number of bytessent. Otherwise, -1 is returned and errno is set to indicate theerror..SH ERRORS.PPThe.BR sendto ()function will fail if:.TP.RB [ EAFNOSUPPORT ]Addresses in the specified address family cannot be used withthis socket..TP.RB [ EAGAIN "] or [" EWOULDBLOCK ]The socket's file descriptor is marked.B O_NONBLOCKand therequested operation would block..TP.RB [ EBADF ]The.I socketargument is not a valid file descriptor..TP.RB [ ECONNRESET ]A connection was forcibly closed by a peer..TP.RB [ EFAULT ]The.I messageor.I dest_addrparameter can not be accessed..TP.RB [ EINTR ]A signal interrupted.BR sendto ()before any data was transmitted..TP.RB [ EMSGSIZE ]The message is too large to be sent all at once, as the socketrequires..TP.RB [ ENOTCONN ]The socket is connection-mode but is not connected..TP.RB [ ENOTSOCK ]The.I socketargument does not refer to a socket..TP.RB [ EOPNOTSUPP ]The.I socketargument is associated with a socket that does notsupport one or more of the values set in.IR flags ..TP.RB [ EPIPE ]The socket is shut down for writing, or the socket isconnection-mode and is no longer connected. In the latter case,and if the socket is of type.BR SOCK_STREAM ,the.B SIGPIPEsignal isgenerated to the calling process..PPIf the address family of the socket is.BR AF_UNIX ,then.BR sendto ()willfail if:.TP.RB [ EIO ]An I/O error occurred while reading from or writing to the filesystem..TP.RB [ ELOOP ]Too many symbolic links were encountered in translating thepathname in the socket address..TP.RB [ ENAMETOOLONG ]A component of a pathname exceeded.RI { NAME_MAX }characters, or anentire pathname exceeded.RI { PATH_MAX }characters..TP.RB [ ENOENT ]A component of the pathname does not name an existing file orthe pathname is an empty string..TP.RB [ ENOTDIR ]A component of the path prefix of the pathname in the socketaddress is not a directory..PPThe.BR sendto ()function may fail if:.TP.RB [ EACCES ]Search permission is denied for a component of the path prefix;or write access to the named socket is denied..TP.RB [ EDESTADDRREQ ]The socket is not connection-mode and does not have its peeraddress set, and no destination address was specified..TP.RB [ EHOSTUNREACH ]The destination host cannot be reached (probably because thehost is down or a remote router cannot reach it)..TP.RB [ EINVAL ]The.I dest_lenargument is not a valid length for the addressfamily..TP.RB [ EIO ]An I/O error occurred while reading from or writing to the filesystem..TP.RB [ EISCONN ]A destination address was specified and the socket is alreadyconnected. This error may or may not be returned for connectionmode sockets..TP.RB [ ENETDOWN ]The local interface used to reach the destination is down..TP.RB [ ENETUNREACH ]No route to the network is present..TP.RB [ ENOBUFS ]Insufficient resources were available in the system to performthe operation..TP.RB [ ENOMEM ]Insufficient memory was available to fulfill the request..TP.RB [ ENOSR ]There were insufficient.IR STREAMS (4)resources available for theoperation to complete..PPIf the address family of the socket is.BR AF_UNIX ,then.BR sendto ()mayfail if:.TP.RB [ ENAMETOOLONG ]Pathname resolution of a symbolic link produced an intermediateresult whose length exceeds.RI { PATH_MAX }..SH "SEE ALSO".PP.BR getsockopt (3),.BR poll (2),.BR recv (3),.BR recvfrom (3),.BR recvmsg (3),.BR select (2),.BR send (3),.BR sendmsg (3),.BR setsockopt (3),.BR shutdown (3),.BR socket (3),.BR <sys/socket.h> (5)..SH "CONFORMING TO".PPThe Open Group XNS Issue 5.2..[xns.].\".\".[$LIST$.].TI
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -