getsockopt(2) System Calls Manual getsockopt(2) NOMBRE getsockopt, setsockopt - obtiene y pone opciones en conectores (sockets) BIBLIOTECA Biblioteca Estandar C (libc, -lc) SINOPSIS #include int getsockopt(int sockfd, int level, int optname, void optval[restrict *.optlen], socklen_t *restrict optlen); int setsockopt(int sockfd, int level, int optname, const void optval[.optlen], socklen_t optlen); DESCRIPCION getsockopt() and setsockopt() manipulate options for the socket referred to by the file descriptor sockfd. Options may exist at multiple protocol levels; they are always present at the uppermost socket level. When manipulating socket options, the level at which the option resides and the name of the option must be specified. To manipulate options at the sockets API level, level is specified as SOL_SOCKET. To manipulate options at any other level the protocol number of the appropriate protocol controlling the option is supplied. For example, to indicate that an option is to be interpreted by the TCP protocol, level should be set to the protocol number of TCP; see getprotoent(3). The arguments optval and optlen are used to access option values for setsockopt(). For getsockopt() they identify a buffer in which the value for the requested option(s) are to be returned. For getsockopt(), optlen is a value-result argument, initially containing the size of the buffer pointed to by optval, and modified on return to indicate the actual size of the value returned. If no option value is to be supplied or returned, optval may be NULL. Optname y cualesquiera opciones especificadas se pasan sin interpretar al modulo de protocolo apropiado para su interpretacion. El fichero de cabecera contiene definiciones para opciones de nivel de conector, descritas mas abajo. Las opciones a otros niveles de protocolo varian en formato y nombre; consulte las paginas apropiadas de la seccion 4 del Manual. La mayoria de las opciones de nivel-conector utilizan un parametro int para optval. Para setsockopt(), el parametro debe ser distinto de cero para permitir una opcion booleana, o cero si la opcion va a ser deshabilitada. Para una descripcion de las opciones disponibles para conectores vea socket(7) y las paginas de manual del protocolo apropiado. VALOR DEVUELTO En caso de exito, se devuelve cero en las operaciones estandar. En caso de error, -1, y se define errno al valor correspondiente. Netfilter allows the programmer to define custom socket options with associated handlers; for such options, the return value on success is the value returned by the handler. ERRORES EBADF El argumento sockfd no es un descriptor de archivo valido. EFAULT La direccion apuntada por optval no esta en un sitio valido del espacio de direcciones del proceso. Para getsockopt(), este error puede tambien ser devuelto si optlen no esta en un sitio valido del espacio de direcciones del proceso. EINVAL optlen invalid in setsockopt(). In some cases this error can also occur for an invalid value in optval (e.g., for the IP_ADD_MEMBERSHIP option described in ip(7)). ENOPROTOOPT La opcion es desconocida al nivel indicado. ENOTSOCK El descriptor de archivo sockfd no se refiere a un conector. ESTANDARES POSIX.1-2008. HISTORIAL POSIX.1-2001, SVr4, 4.4BSD (first appeared in 4.2BSD). ERRORES Algunas de las opciones de conector deberian ser manejadas a niveles mas bajos del sistema. VEASE TAMBIEN ioctl(2), socket(2), getprotoent(3), protocols(5), ip(7), packet(7), socket(7), tcp(7), udp(7), unix(7) TRADUCCION La traduccion al espanol de esta pagina del manual fue creada por Juan Piernas , Miguel Perez Ibars y Marcos Fouces Esta traduccion es documentacion libre; lea la GNU General Public License Version 3 o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD. Si encuentra algun error en la traduccion de esta pagina del manual, envie un correo electronico a . Paginas de Manual de Linux 6.12 23 Julio 2024 getsockopt(2)