File: send.2

package info (click to toggle)
manpages-es 1.24a-6
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,256 kB
  • ctags: 7
  • sloc: makefile: 66; sh: 62
file content (224 lines) | stat: -rw-r--r-- 7,552 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
.\" Copyright (c) 1983, 1991 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"     $Id: send.2,v 1.5 1999/06/12 10:11:39 freitag Exp $
.\"
.\" Modified Sat Jul 24 01:15:33 1993 by Rik Faith <faith@cs.unc.edu>
.\" Modified Tue Oct 22 17:55:49 1996 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified Oct 1998 by Andi Kleen
.\" Translation revised Tue Apr 6 1999 by Juan Piernas <piernas@ditec.um.es>
.\" Translation revised Sun Jun 27 1999 by Juan Piernas <piernas@ditec.um.es>
.\"
.TH SEND 2 "Julio 1999" "Pagina man de Linux" "Manual del Programador de Linux"
.SH NOMBRE
send, sendto, sendmsg \- enva un mensaje de un conector (socket)
.SH SINTAXIS
.B #include <sys/types.h>
.br
.B #include <sys/socket.h>
.sp
.BI "int send(int " s ", const void *" msg ", size_t " len ","
.BI "int " flags );
.br
.BI "int sendto(int " s ", const void *" msg ", size_t " len ","
.BI "int " flags ", const struct sockaddr *" to ", socklen_t " tolen );
.br
.BI "int sendmsg(int " s ", const struct msghdr *" msg ","
.BI "int " flags );
.SH DESCRIPCIN
.BR Send ,
.BR sendto
y
.B sendmsg
son utilizados para transmitir un mensaje a otro conector.
.B Send
solo puede ser usado cuando un conector est en un estado
.I connected
mientras
.B sendto
y
.B sendmsg
pueden ser utilizados en cualquier momento.
.PP
La direccin de destino viene dada por
.I to
con
.I tolen
especificando su tamao. La longitud del mensaje viene dada por
.IR len .
Si el mensaje es demasiado largo para pasar automticamente a travs del
protocolo inferior, se devuelve el error
.B EMSGSIZE
y el mensaje no es transmitido.
.PP
La llamada
.B send
lleva implcita el que no se indiquen los posibles errores en la entrega.
Los errores detectados localmente se indican devolviendo un valor \-1.
.PP
Cuando el mensaje no cabe en el buffer de envo del conector,
.B send
se bloquea, a no ser que el conector se haya colocado en el modo de E/S no
bloqueante. En el modo no bloqueante devolvera
.B EAGAIN
en este caso. Se puede utilizar la llamada
.BR select (2)
para determinar cuando es posible enviar ms informacin.
.PP
El parmetro
.I flags
puede contener uno o ms de los siguientes valores:
.\" XXX is it needed to document MSG_SYN,MSG_FIN,MSG_SYN,MSG_URG,MSG_RST ?
.\"     they seem to be somehow used with unix fd passing.
.\" XXX document MSG_PROXY
.PP
.RS
.nf
.ta 4n 26n 34n
#define MSG_OOB	0x1	/* procesar datos fuera de
			orden (out-of-band data) */
#define MSG_DONTROUTE	0x4	/* omitir el enrutamiento, usar
			la interfaz directa */
#define MSG_DONTWAIT	0x40	/* no bloquearse */
#define MSG_NOSIGNAL	0x2000	/* no producir SIGPIPE */
.ta
.fi
.RE
.TP
.B MSG_OOB
Enviar datos
.IR "fuera de orden" (out-of-band)
en conectores que soportan esta nocin (p.ej. 
.BR SOCK_STREAM );
el protocolo subyacente tambin debe soportar datos
.IR "fuera de orden" .
.TP
.B MSG_DONTROUTE
Omitir la bsqueda habitual en la tabla de enrutamiento y enviar el paquete
directamente a la interfaz descrita por la direccin de destino. Esto lo
utilizan normalmente los programas de diagnstico y enrutamiento.
.TP
.B MSG_DONTWAIT
Habilitar el funcionamiento no bloqueante. Si la operacin se bloqueara, se
devolvera
.BR EAGAIN .
.TP
.B MSG_NOSIGNAL
Solicitar el no enviar
.B SIGPIPE
en caso de error en conectores orientados a conexin cuando el otro extremo
rompa la conexin. Todava se devuelve el error
.BR EPIPE .
.PP
Vea 
.BR recv (2)
para una descripcin de la estructura
.IR msghdr .
Puede enviar informacin de control usando los miembros
.I msg_control
y
.IR msg_controllen .
La longitud mxima del buffer de control que el ncleo puede procesar est
limitada por conector por la sysctl
.BR net.core.optmem_max .
Vea
.BR socket (7).
.SH "VALOR DEVUELTO"
Las llamadas devuelven el numero de caracteres enviados, o \-1
si ha ocurrido un error.
.SH ERRORES
Estos son algunos errores estndares generados por la capa de conectores.
Los mdulos de los protocolos subyacentes pueden generar y devolver errores
adicionales. Vea sus pginas de manual respectivas.
.TP 0.8i
.B EBADF
Se ha especificado un descriptor no vlido.
.TP
.B ENOTSOCK
El argumento
.I s
no es un conector.
.TP
.B EFAULT
Se ha especificado como parmetro una direccin incorrecta del espacio de
usuario.
tro.
.TP
.B EMSGSIZE
El conector requiere que este mensaje sea enviado automticamente, y el tamao 
del mensaje a ser enviado lo hace imposible.
.TP
.BR EAGAIN " o " EWOULDBLOCK
El conector est marcado como no bloqueante y la operacin solicitada
lo bloqueara.
.TP
.B ENOBUFS
La cola de salida del interface de red est llena.
Esto generalmente indica que el interfaz ha parado de enviar,
pero puede ser causado por una congestin temporal.
(Esto no puede ocurrir en Linux, los paquetes simplemente se suprimen
silenciosamente cuando la cola de un dispositivo se desborda.(
.TP
.B EINTR
Se ha producido una seal.
.TP
.B ENOMEM
No hay memoria disponible.
.TP
.B EINVAL
Se ha pasado un argumento invlido.
.TP
.B EPIPE
Se ha desconectado el extremo local en un conector orientado a conexin.
En este caso el proceso tamben recibir una seal
.B SIGPIPE
a menos que se active la opcin
.BR MSG_NOSIGNAL .
.SH "CONFORME A"
4.4BSD, SVr4, borrador POSIX 1003.1g (estas llamadas a funcin aparecieron
en 4.2BSD).
.SH NOTA
Los prototipos indicados ms arriba siguen `the Single Unix Specification',
ya que glibc2 tambin lo hace; el argumento
.I flags
era `int' en BSD 4.* pero `unsigned int' en libc4 y libc5;
el argumento 
.I len
era `int' en BSD 4.* y libc4 pero `size_t' en libc5;
el argumento
.I tolen
era `int' en BSD 4.*, libc4 y libc5.
Vea tambin
.BR accept (2).
.SH "VASE TAMBIN"
.BR fcntl "(2), " recv "(2), " select "(2), " getsockopt "(2), "
.BR sendfile "(2), " socket "(2), " write "(2), "
.BR socket "(7), " ip "(7), " tcp "(7), " udp (7)