⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setsockopt.3.man

📁 This a separate release of the OpenSS7 X/Open XTI/TLI library, TLI modules (timod, tirdwr) and the I
💻 MAN
字号:
'\" rtp.\" -*- nroff -*- vim: ft=nroff noautoindent nocindent nosmartindent.\".\" @(#) setsockopt.3.man,v 1.1.2.1 2004/05/16 02:35:35 brian Exp.\".\" =========================================================================.\".\" Copyright (C) 2001-2004  OpenSS7 Corporation <www.openss7.com>.\".\" All Rights Reserved..\".\" Permission is granted to make and distribute verbatim copies of this.\" manual provided the copyright notice and this permission notice are.\" preserved on all copies..\".\" Permission is granted to copy and distribute modified versions of this.\" manual under the conditions for verbatim copying, provided that the.\" entire resulting derived work is distributed under the terms of a.\" permission notice identical to this one.\" .\" Since the Linux kernel and libraries are constantly changing, this.\" manual page may be incorrect or out-of-date.  The author(s) assume no.\" responsibility for errors or omissions, or for damages resulting from.\" the use of the information contained herein.  The author(s) may not.\" have taken the same level of care in the production of this manual,.\" which is licensed free of charge, as they might when working.\" professionally..\" .\" Formatted or processed versions of this manual, if unaccompanied by.\" the source, must acknowledge the copyright and authors of this work..\".\" -------------------------------------------------------------------------.\".\" U.S. GOVERNMENT RESTRICTED RIGHTS.  If you are licensing this Software.\" on behalf of the U.S. Government ("Government"), the following.\" provisions apply to you.  If the Software is supplied by the Department.\" of Defense ("DoD"), it is classified as "Commercial Computer Software".\" under paragraph 252.227-7014 of the DoD Supplement to the Federal.\" Acquisition Regulations ("DFARS") (or any successor regulations) and the.\" Government is acquiring only the license rights granted herein (the.\" license rights customarily provided to non-Government users).  If the.\" Software is supplied to any unit or agency of the Government other than.\" DoD, it is classified as "Restricted Computer Software" and the.\" Government's rights in the Software are defined in paragraph 52.227-19.\" of the Federal Acquisition Regulations ("FAR") (or any success.\" regulations) or, in the cases of NASA, in paragraph 18.52.227-86 of the.\" NASA Supplement to the FAR (or any successor regulations)..\".\" =========================================================================.\" .\" Commercial licensing and support of this software is available from.\" OpenSS7 Corporation at a fee.  See http://www.openss7.com/.\" .\" =========================================================================.\".\" Last Modified 2004/05/16 02:35:35 by brian.\".\" =========================================================================.so strxnet.macros.R1bracket-label "\fR[\fB" "\fR]" "\fR, \fB"no-default-databasedatabase strxnet.refsaccumulatemove-punctuationabbreviate Ajoin-authors ", " ", " " and "et-al " et al" 2 3abbreviate-label-ranges ".."sort-adjacent-labels.R2.\".\".\".\".TH SETSOCKOPT 3 "2004/05/16 02:35:35" "strxnet-0_9_2-4" "Linux Fast-STREAMS Sockets Library".SH NAME.B setsockopt\- set the socket options.SH SYNOPSIS.PP.B #include <sys/socket.h>.HP.BI "int setsockopt(int " socket ", int " level ", int " option_name ", const void *" option_value ", socklen_t " option_len );.SH DESCRIPTION.PPThe.BR setsockopt ()function sets the option specified by the.I option_nameargument, at the protocol level specified by the.I levelargument, to the value pointed to by the.I option_valueargument forthe socket associated with the file descriptor specified by the.I socketargument..PPThe.I levelargument specifies the protocol level at which the optionresides.  To set options at the socket level, specify the.I levelargument as.BR SOL_SOCKET .To set options at other levels, supply theappropriate lecel identifier for the protocol controlling theoption.  For example, to indicate that an option will be interpretedby the TCP (Transport Control Protocol), set.I levelto.B IPPROTO_TCPas defined in the <netinet/in.h> header..PPThe.I option_nameargument specifies a single option to set.  The.I option_nameargument and any specified options are passeduninterpreted to the appropriate protocol module forinterpretations.  The <sys/socket.h> header defines the socket leveloptions.  The options are as follows:.TP.B SO_DEBUGTurns on recording of debugging information.  This optionenables or disables debugging in the underlying protocolmodules.  This option takes an int value.  This is a booleanoption..TP.B SO_BROADCASTPermits sending of broadcast messages, if this is supported bythe protocol.  This option takes an int value.  This is a booleanoption..TP.B SO_REUSEADDRSpecifies that the rules used in validating addresses suppliedto.BR bind (3)should allow reuse of local addresses, if this issupported by the protocol.  This option takes an int value.  Thisis a boolean option..TP.B SO_KEEPALIVEKeeps connections active by enabling the periodic transmissionof messages, if this is supported by the protocol.  This optiontakes an int value.If the connected socket fails to respond to these messages, theconnection is broken and processes writing to that socket arenotified with a.B SIGPIPEsignal.This is a boolean option..TP.B SO_LINGERLingers on a.BR close (2)if data is present.  This optioncontrols the action taken when unsent messages queue on asocket and.BR close (2)is performed.  If.B SO_LINGERis set, thesystem blocks the process during.BR close (2)until it cantransmit the data or until the time expires.  If.B SO_LINGERisnot specified, and.BR close (2)is issued, the system handles thecall in a way that allows the process to continue as quickly aspossible.  This option takes a linger structure, as defined inthe <sys/socket.h> header, to specify the state of the optionand linger interval..TP.B SO_OOBINLINELeaves received out-of-band data (data marked urgent) in line.This option takes an int value.  This is a boolean option..TP.B SO_SNDBUFSets send buffer size.  This option takes an int value..TP.B SO_RCVBUFSets receive buffer size.  This option takes an int value..TP.B SO_DONTROUTERequests that outgoing messages bypass the standard routingfacilities.  The destination must be on a directly-connectednetwork, and messages are directed to the appropriate networkinterface according to the destination address.  The effect, ifany, of this option depends on what protocol is in use.  Thisoption takes an int value.  This is a boolean option..TP.B SO_RCVLOWATSets the minimum number of bytes to process for socket inputoperations.  The default value for.B SO_RCVLOWATis 1.  If.B SO_RCVLOWATis set to a larger value, blocking receive callsnormally wait until they have received the smaller of the lowwater mark value or the requested amount.  (They may return lessthan the low water mark if an error occurs, a signal is caught,or the type of data next in the receive queue is different thanthat returned, e.g.  out of band data).  This option takes an intvalue.  Note that not all implementations allow this option tobe set..TP.B SO_RCVTIMEOSets the timeout value that specifies the maximum amount oftime an input function waits until it completes.  It accepts atimeval structure with the number of seconds and microsecondsspecifying the limit on how long to wait for an input operationto complete.  If a receive operation has blocked for this muchtime without receiving additional data, it returns with apartial count or errno set to.RB [ EAGAIN "] or [" EWOULDBLOCK ]if nodata were received.  The default for this option is zero, whichindicates that a receive operation will not time out.  Thisoption takes a timeval structure.  Note that not allimplementations allow this option to be set..TP.B SO_SNDLOWATSets the minimum number of bytes to process for socket outputoperations.  Non-blocking output operations will process no dataif flow control does not allow the smaller of the send lowwater mark value or the entire request to be processed.  Thisoption takes an int value.  Note that not all implementationsallow this option to be set..TP.B SO_SNDTIMEOSets the timeout value specifying the amount of time that anoutput function blocks because flow control prevents data frombeing sent.  If a send operation has blocked for this time, itreturns with a partial count or with errno set to.RB [ EAGAIN "] or [" EWOULDBLOCK ]if no data were sent.  The default for this optionis zero, which indicates that a send operation will not timeout.  This option stores a timeval structure.  Note that not allimplementations allow this option to be set..PPFor boolean options, 0 indicates that the option is disabled and 1indicates that the option is enabled..PPOptions at other protocol levels vary in format and name..SH NOTES.PPThe.BR setsockopt ()function provides an application program with themeans to control socket behaviour.  An application program can use.BR setsockopt ()to allocate buffer space, control timeouts, or permitsocket data broadcasts.  The <sys/socket.h> header defines thesocket-level options available to.BR setsockopt ()..PPOptions may exist at multiple protocol levels.  The.B SO_options arealways present at the uppermost socket level..SH CAVEATS.PPThis system call is implemented as a.B SIOCSOCKSYSIOCTL.  See.BR socksys (4)for more information..SH "RETURN VALUE".PPUpon successful completion,.BR setsockopt ()returns 0.  Otherwise, -1is returned and errno is set to indicate the error..SH ERRORS.PPThe.BR setsockopt ()function will fail if:.TP.RB [ EBADF ]The.I socketargument is not a valid file descriptor..TP.RB [ EDOM ]The send and receive timeout values are too big to fit into thetimeout fields in the socket structure..TP.RB [ EFAULT ]The.I option_valueparameter can not be accessed or written..TP.RB [ EINVAL ]The specified option is invalid at the specified socket levelor the socket has been shut down..TP.RB [ EISCONN ]The socket is already connected, and a specified option can notbe set while the socket is connected..TP.RB [ ENOPROTOOPT ]The option is not supported by the protocol..TP.RB [ ENOTSOCK ]The.I socketargument does not refer to a socket..PPThe.BR setsockopt ()function may fail if:.TP.RB [ ENOMEM ]There was insufficient memory available for the operation tocomplete..TP.RB [ ENOBUFS ]Insufficient resources are available in the system to completethe call..TP.RB [ ENOSR ]There were insufficient.IR STREAMS (4)resources available for theoperation to complete..SH "SEE ALSO".PP.BR bind (3),.BR endprotoent (2),.BR getsockopt (3),.BR socket (3),.BR <sys/socket.h> ..SH "CONFORMING TO".PPThe Open Group XNS Issue 5.2..[xns.].\".\".[$LIST$.].TI

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -