xref: /386bsd/usr/share/man/cat2/sendto.0 (revision a2142627)
1SEND(2)                   386BSD Programmer's Manual                   SEND(2)
2
3NNAAMMEE
4     sseenndd, sseennddttoo, sseennddmmssgg - send a message from a socket
5
6SSYYNNOOPPSSIISS
7     ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
8     ##iinncclluuddee <<ssyyss//ssoocckkeett..hh>>
9
10     _i_n_t
11     sseenndd(_i_n_t _s, _c_o_n_s_t _v_o_i_d *_m_s_g, _i_n_t _l_e_n, _i_n_t _f_l_a_g_s)
12
13     _i_n_t
14     sseennddttoo(_i_n_t _s, _c_o_n_s_t _v_o_i_d *_m_s_g, _i_n_t _l_e_n, _i_n_t _f_l_a_g_s,
15             _c_o_n_s_t _s_t_r_u_c_t _s_o_c_k_a_d_d_r *_t_o, _i_n_t _t_o_l_e_n)
16
17     _i_n_t
18     sseennddmmssgg(_i_n_t _s, _c_o_n_s_t _s_t_r_u_c_t _m_s_g_h_d_r *_m_s_g, _i_n_t _f_l_a_g_s)
19
20DDEESSCCRRIIPPTTIIOONN
21     SSeenndd(), sseennddttoo(), and sseennddmmssgg() are used to transmit a message to another
22     socket.  SSeenndd() may be used only when the socket is in a _c_o_n_n_e_c_t_e_d state,
23     while sseennddttoo() and sseennddmmssgg() may be used at any time.
24
25     The address of the target is given by _t_o with _t_o_l_e_n specifying its size.
26     The length of the message is given by _l_e_n. If the message is too long to
27     pass atomically through the underlying protocol, the error EMSGSIZE is
28     returned, and the message is not transmitted.
29
30     No indication of failure to deliver is implicit in a sseenndd().  Locally
31     detected errors are indicated by a return value of -1.
32
33     If no messages space is available at the socket to hold the message to be
34     transmitted, then sseenndd() normally blocks, unless the socket has been
35     placed in non-blocking I/O mode.  The select(2) call may be used to
36     determine when it is possible to send more data.
37
38     The _f_l_a_g_s parameter may include one or more of the following:
39
40     #define MSG_OOB        0x1  /* process out-of-band data */
41     #define MSG_DONTROUTE  0x4  /* bypass routing, use direct interface */
42
43     The flag MSG_OOB is used to send ``out-of-band'' data on sockets that
44     support this notion (e.g.  SOCK_STREAM); the underlying protocol must
45     also support ``out-of-band'' data.  MSG_DONTROUTE is usually used only by
46     diagnostic or routing programs.
47
48     See recv(2) for a description of the _m_s_g_h_d_r structure.
49
50RREETTUURRNN VVAALLUUEESS
51     The call returns the number of characters sent, or -1 if an error
52     occurred.
53
54EERRRROORRSS
55     SSeenndd(), sseennddttoo(), and sseennddmmssgg() fail if:
56
57     [EBADF]        An invalid descriptor was specified.
58
59     [ENOTSOCK]     The argument _s is not a socket.
60
61     [EFAULT]       An invalid user space address was specified for a
62                    parameter.
63
64     [EMSGSIZE]     The socket requires that message be sent atomically, and
65
66                    the size of the message to be sent made this impossible.
67
68     [EWOULDBLOCK]  The socket is marked non-blocking and the requested
69                    operation would block.
70
71     [ENOBUFS]      The system was unable to allocate an internal buffer.  The
72                    operation may succeed when buffers become available.
73
74     [ENOBUFS]      The output queue for a network interface was full.  This
75                    generally indicates that the interface has stopped
76                    sending, but may be caused by transient congestion.
77
78SSEEEE AALLSSOO
79     fcntl(2),  recv(2),  select(2),  getsockopt(2),  socket(2),  write(2)
80
81HHIISSTTOORRYY
82     The sseenndd function call appeared in 4.2BSD.
83
844.2 Berkeley Distribution         May 1, 1991                                2
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133