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
|
.\" 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.
.\"
.\" @(#)send.2 6.9 (Berkeley) 5/1/91
.\"
.\" 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>
.\" Translation fixes by Nicols Lichtmaier 12/4/1998 <nick@debian.org>
.\"
.TH SEND 2 "24 de Julio de 1993" "Pagina del Manual de BSD" "Manual del Programador Linux"
.SH NOMBRE
send, sendto, sendmsg \- enva un mensaje de un socket
.SH SINTAXIS
.B #include <sys/types.h>
.br
.B #include <sys/socket.h>
.sp 2
.BI "int send(int " s ", const void *" msg ", int " len ","
.BI "unsigned int " flags );
.sp
.BI "int sendto(int " s ", const void *" msg ", int " len ","
.BI "unsigned int " flags ", const struct sockaddr *" to ", int " tolen );
.sp
.BI "int sendmsg(int " s ", const struct msghdr *" msg ","
.BI "unsigned int " flags );
.SH DESCRIPCIN
ATENCIN: sta es una pgina de manual BSD. Hasta Linux 0.99.11,
la funcin
.B sendmsg
no ha sido implementada.
.BR Send ,
.BR sendto ,
y
.B sendmsg
son utilizadas para transmitir un mensaje a otro socket.
.B Send
slo puede ser usada cuando un socket est en un estado
.I conectado
mientras
.B sendto
y
.B sendmsg
pueden ser utilizadas en cualquier momento.
La direccin de destino viene dada por
.IR 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 subyacente, es devuelto el error
.B EMSGSIZE
y el mensaje no es transmitido.
La no indicacin de un error viene implcita en una llamada a
.BR send .
Errores detectados localmente son indicados mediante un valor de retorno \-1.
Si no existe espacio disponible en el socket para contener el mensaje a enviar,
entonces
.B send
se bloquea, a no ser que el socket haya sido puesto en modo de no bloqueo
para la E/S. La llamada
.BR select (2)
puede ser utilizada para determinar cuando es posible enviar ms datos.
El parmetro
.I flags
puede contener uno o ms de los siguientes valores:
.RS
.nf
#define MSG_OOB 0x1 /* procesa datos fuera-de-banda */
#define MSG_DONTROUTE 0x4 /* ignora ruteo, usa directamente
la interface */
.fi
.RE
El parmetro
.B MSG_OOB
es utilizado para enviar datos
.I fuera-de-banda
en sockets que soportan esta nocin (p. ej.
.BR SOCK_STREAM );
el protocolo subyacente tambin debe soportar datos
.IR fuera-de-banda .
.B MSG_DONTROUTE
es utilizado solo para diagnstico o para programas de enrutado.
Vea
.BR recv (2)
para una descripcin de la estructura
.I msghdr
.SH "VALORES DEVUELTOS"
La llamada retorna el numero de caracteres enviados, o \-1
si ha ocurrido un error.
.SH ERRORES
.TP 0.8i
.B EBADF
Un descriptor no vlido ha sido especificado.
.TP
.B ENOTSOCK
El argumento
.I s
no es un socket.
.TP
.B EFAULT
Una direccin de espacio de usuario incorrecta ha sido especificada como
parmetro.
.TP
.B EMSGSIZE
El socket requiere que este mensaje sea enviado automticamente, y el tamao
del mensaje lo hace imposible.
.TP
.B EWOULDBLOCK
El socket est marcado como "non-bloqueante" y la operacin solicitada
bloqueara.
.TP
.B ENOBUFS
El sistema ha sido incapaz de habilitar un buffer interno.
La operacin podra tener xito cuando haya buffers disponibles.
.TP
.B ENOBUFS
La cola de salida de la interfaz de red est llena.
Esto generalmente indica que la interfaz ha parado de enviar,
pero puede deberse tambin a una congestin temporal.
.SH "COMPATIBLE CON"
4.4BSD, SVr4 (estas llamadas al sistema aparecieron en BSD4.2). Las versiones SV4r
documentan las condiciones de error adicionales
.BR EINVAL ,\ EINTR ,\ EMSGSIZE ,\ ENOSR ,\ ENOMEM .
.SH "VASE TAMBIN"
.BR fcntl "(2), " recv "(2), " select "(2), " getsockopt "(2), "
.BR socket "(2), " write (2)
|