?? send.2
字號:
.\" SCCSID: @(#)send.2 8.1 9/11/90.TH send 2.SH Namesend, sendto, sendmsg \- send a message from a socket.SH Syntax.nf.ft B#include <sys/types.h>#include <sys/socket.h>.PP.ft Bcc = send(s, msg, len, flags)int cc, s;char *msg;int len, flags;.PP.ft Bcc = sendto(s, msg, len, flags, to, tolen)int cc, s;char *msg;int len, flags;struct sockaddr *to;int tolen;.PP.ft Bcc = sendmsg(s, msg, flags)int cc, s;struct msghdr msg[];int flags;.fi.SH Description.NXR "send system call".NXR "sendto system call".NXR "sendmsg system call".NXA "send system call" "recv system call".NXR "socket" "sending message from"The.PN send ,.PN sendto ,and.PN sendmsgsystem callsare used to transmit a message to another socket.The.PN sendsystem callmay be used only when the socket is in a .I connectedstate, while the .PN sendtoand.PN sendmsgsystem callsmay be used at any time..PPThe address of the target is given by.IR to ,with .I tolenspecifying its size.The length of the message is given by.IR len .If the message is too long to pass atomically through theunderlying protocol, the error EMSGSIZE is returned, andthe message is not transmitted. If the address specifiedin the argument is a broadcast address, the SO_BROADCASToption must be set for broadcasting to succeed..PPNo indication of failure to deliver is implicit in a.PN send .Return values of \-1 indicate some locally detected errors..PPIf no messages space is available at the socket to holdthe message to be transmitted, .PN sendnormally blocks, unless the socket has been placed innonblocking I/O mode.The .MS select 2call can be used to determine when it is possible tosend more data..PPThe.I flagsparameter can be set to MSG_OOB to send out-of-banddata on sockets that support this features (for example, SOCK_STREAM)..PPSee .MS recv 2for a description of the.I msghdrstructure..PPThe call returns the number of characters sent, or \-1if an error occurred..SH Diagnostics.NXR "send system call" "diagnostics".TP 20[EBADF]An invalid descriptor was specified..TP 20[EDESTADDRREQ]A required address was omitted from an operation on a socket..TP 20[EFAULT]An invalid user space address was specified for a parameter..TP 20[EINVAL]An invalid argument length for the message was specified..TP 20[EINTR]The send was interrupted by delivery of a signal..TP 20[ENOTCONN]The socket is not connected..TP 20[ENOTSOCK]The argument \fIs\fP is not a socket..TP 20[EMSGSIZE]The socket requires that messages be sent atomically,and the size of the message to be sent made this impossible..TP 20[EPIPE]A write on a pipe or socket for which there is no process to read the data..TP 20[EWOULDBLOCK]The socket is marked nonblocking, and the requested operationwould block..SH See Alsorecv(2), getsockopt(2), socket(2)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -