Commit | Line | Data |
---|---|---|
2cf6fecc C |
1 | |
2 | ||
3 | ||
4 | SEND(2) UNIX Programmer's Manual SEND(2) | |
5 | ||
6 | ||
7 | ||
8 | N\bNA\bAM\bME\bE | |
9 | send, sendto, sendmsg - send a message from a socket | |
10 | ||
11 | S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS | |
12 | #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b> | |
13 | #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b> | |
14 | ||
15 | c\bcc\bc =\b= s\bse\ben\bnd\bd(\b(s\bs,\b, m\bms\bsg\bg,\b, l\ble\ben\bn,\b, f\bfl\bla\bag\bgs\bs)\b) | |
16 | i\bin\bnt\bt c\bcc\bc,\b, s\bs;\b; | |
17 | c\bch\bha\bar\br *\b*m\bms\bsg\bg;\b; | |
18 | i\bin\bnt\bt l\ble\ben\bn,\b, f\bfl\bla\bag\bgs\bs;\b; | |
19 | ||
20 | c\bcc\bc =\b= s\bse\ben\bnd\bdt\bto\bo(\b(s\bs,\b, m\bms\bsg\bg,\b, l\ble\ben\bn,\b, f\bfl\bla\bag\bgs\bs,\b, t\bto\bo,\b, t\bto\bol\ble\ben\bn)\b) | |
21 | i\bin\bnt\bt c\bcc\bc,\b, s\bs;\b; | |
22 | c\bch\bha\bar\br *\b*m\bms\bsg\bg;\b; | |
23 | i\bin\bnt\bt l\ble\ben\bn,\b, f\bfl\bla\bag\bgs\bs;\b; | |
24 | s\bst\btr\bru\buc\bct\bt s\bso\boc\bck\bka\bad\bdd\bdr\br *\b*t\bto\bo;\b; | |
25 | i\bin\bnt\bt t\bto\bol\ble\ben\bn;\b; | |
26 | ||
27 | c\bcc\bc =\b= s\bse\ben\bnd\bdm\bms\bsg\bg(\b(s\bs,\b, m\bms\bsg\bg,\b, f\bfl\bla\bag\bgs\bs)\b) | |
28 | i\bin\bnt\bt c\bcc\bc,\b, s\bs;\b; | |
29 | s\bst\btr\bru\buc\bct\bt m\bms\bsg\bgh\bhd\bdr\br *\b*m\bms\bsg\bg;\b; | |
30 | i\bin\bnt\bt f\bfl\bla\bag\bgs\bs;\b; | |
31 | ||
32 | D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN | |
33 | _\bS_\be_\bn_\bd, _\bs_\be_\bn_\bd_\bt_\bo, and _\bs_\be_\bn_\bd_\bm_\bs_\bg are used to transmit a message to | |
34 | another socket. _\bS_\be_\bn_\bd may be used only when the socket is in | |
35 | a _\bc_\bo_\bn_\bn_\be_\bc_\bt_\be_\bd state, while _\bs_\be_\bn_\bd_\bt_\bo and _\bs_\be_\bn_\bd_\bm_\bs_\bg may be used at | |
36 | any time. | |
37 | ||
38 | The address of the target is given by _\bt_\bo with _\bt_\bo_\bl_\be_\bn specify- | |
39 | ing its size. The length of the message is given by _\bl_\be_\bn. | |
40 | If the message is too long to pass atomically through the | |
41 | underlying protocol, then the error EMSGSIZE is returned, | |
42 | and the message is not transmitted. | |
43 | ||
44 | No indication of failure to deliver is implicit in a _\bs_\be_\bn_\bd. | |
45 | Return values of -1 indicate some locally detected errors. | |
46 | ||
47 | If no messages space is available at the socket to hold the | |
48 | message to be transmitted, then _\bs_\be_\bn_\bd normally blocks, unless | |
49 | the socket has been placed in non-blocking I/O mode. The | |
50 | _\bs_\be_\bl_\be_\bc_\bt(2) call may be used to determine when it is possible | |
51 | to send more data. | |
52 | ||
53 | The _\bf_\bl_\ba_\bg_\bs parameter may include one or more of the follow- | |
54 | ing: | |
55 | ||
56 | #define MSG_OOB 0x1 /* process out-of-band data */ | |
57 | #define MSG_DONTROUTE 0x4 /* bypass routing, use direct interface */ | |
58 | The flag MSG_OOB is used to send "out-of-band" data on sock- | |
59 | ets that support this notion (e.g. SOCK_STREAM); the | |
60 | ||
61 | ||
62 | ||
63 | Printed 7/9/88 July 21, 1987 1 | |
64 | ||
65 | ||
66 | ||
67 | ||
68 | ||
69 | ||
70 | SEND(2) UNIX Programmer's Manual SEND(2) | |
71 | ||
72 | ||
73 | ||
74 | underlying protocol must also support "out-of-band" data. | |
75 | MSG_DONTROUTE is usually used only by diagnostic or routing | |
76 | programs. | |
77 | ||
78 | See _\br_\be_\bc_\bv(2) for a description of the _\bm_\bs_\bg_\bh_\bd_\br structure. | |
79 | ||
80 | R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bE | |
81 | The call returns the number of characters sent, or -1 if an | |
82 | error occurred. | |
83 | ||
84 | E\bER\bRR\bRO\bOR\bRS\bS | |
85 | [EBADF] An invalid descriptor was specified. | |
86 | ||
87 | [ENOTSOCK] The argument _\bs is not a socket. | |
88 | ||
89 | [EFAULT] An invalid user space address was speci- | |
90 | fied for a parameter. | |
91 | ||
92 | [EMSGSIZE] The socket requires that message be sent | |
93 | atomically, and the size of the message | |
94 | to be sent made this impossible. | |
95 | ||
96 | [EWOULDBLOCK] The socket is marked non-blocking and | |
97 | the requested operation would block. | |
98 | ||
99 | [ENOBUFS] The system was unable to allocate an | |
100 | internal buffer. The operation may | |
101 | succeed when buffers become available. | |
102 | ||
103 | [ENOBUFS] The output queue for a network interface | |
104 | was full. This generally indicates that | |
105 | the interface has stopped sending, but | |
106 | may be caused by transient congestion. | |
107 | ||
108 | S\bSE\bEE\bE A\bAL\bLS\bSO\bO | |
109 | fcntl(2), recv(2), select(2), getsockopt(2), socket(2), | |
110 | write(2) | |
111 | ||
112 | ||
113 | ||
114 | ||
115 | ||
116 | ||
117 | ||
118 | ||
119 | ||
120 | ||
121 | ||
122 | ||
123 | ||
124 | ||
125 | ||
126 | ||
127 | ||
128 | ||
129 | Printed 7/9/88 July 21, 1987 2 | |
130 | ||
131 | ||
132 |