成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

socket 中文man頁面

系統(tǒng)
本手冊頁介紹了 Linux 套接字的用戶接口. 這個 BSD 兼容套接字是介于用戶進程與內(nèi)核網(wǎng)絡(luò)協(xié)議棧之間的統(tǒng)一接口, 各協(xié)議模塊屬于不同的 協(xié)議族 ,如 PF_INET, PF_IPX, PF_PACKET 和 套接字類型 ,如 字節(jié)流(SOCK_STREAM) 或 數(shù)據(jù)報(SOCK_DGRAM). 關(guān)于協(xié)議族和套接字類型請參考 socket(2).

NAME

socket - Linux 套接字  

總覽

#include <sys/socket.h>
mysocket = socket(int socket_family, int socket_type, int protocol);

描述

本手冊頁介紹了 Linux 套接字的用戶接口. 這個 BSD 兼容套接字是介于用戶進程與內(nèi)核網(wǎng)絡(luò)協(xié)議棧之間的統(tǒng)一接口, 各協(xié)議模塊屬于不同的 協(xié)議族 ,如 PF_INET, PF_IPX, PF_PACKET套接字類型 ,如 字節(jié)流(SOCK_STREAM)數(shù)據(jù)報(SOCK_DGRAM). 關(guān)于協(xié)議族和套接字類型請參考 socket(2).

套接層函數(shù)

用戶通過這些套接字函數(shù)發(fā)送和接收包, 以及其他套接字操作. 詳細說明參看他們各自的手冊頁.

socket(2) 創(chuàng)建套接字,

connect(2) 與遠程套接字地址建立連接

bind(2) 把套接字和一個本地套接字地址綁定在一起(為套接字分配一個本地協(xié)議地址)

listen(2) 通知套接字接受新的連接

accept(2) 為新的已完成連接獲得新的描述字

socketpair(2) 返回兩個連接的匿名套接字(僅在某些本地族中才有實現(xiàn),如 PF_UNIX

send(2),

sendto(2), 和 sendmsg(2) 通過套接字發(fā)送數(shù)據(jù),而 recv(2), recvfrom(2), recvmsg(2) 從套接字接收數(shù)據(jù). poll(2) 和

select(2) 等待數(shù)據(jù)到來或準(zhǔn)備好接收數(shù)據(jù). 除此之外, 標(biāo)準(zhǔn) I/O 操作如 write(2), writev(2), sendfile(2), read(2), 和 readv(2) 也可用來讀入(接收)和寫出(發(fā)送)數(shù)據(jù).

getsockname(2) 用于獲得本地套接字地址

getpeername(2) 用于獲得遠端套接字地址. getsockopt(2) 和 setsockopt(2) 用于設(shè)置或取得套接字或協(xié)議選項. ioctl(2) 也可以用來設(shè)置或讀取一些其他選項.

close(2) 關(guān)閉套接字. shutdown(2) 關(guān)閉全雙工套接字連接的一部分.

套接字不支持搜索,也不支持調(diào)用 pread(2) 或 pwrite(2) 進行非 0 位置的操作. 可以用 fcntl(2). 設(shè)置 O_NONBLOCK 標(biāo)志來實現(xiàn)對套接字的非阻塞 I/O 操作 O_NONBLOCK 是從 accept 繼承來的,然后原來所有會阻塞的操作會返回 EAGAIN. connect(2) 在此情況下返回 EINPROGRESS 錯誤. 用戶可以通過 poll(2) 或者 select(2) 等待各種事件.

I/O 事件
 
事件 輪詢標(biāo)志 發(fā)生事件
 
POLLIN 新數(shù)據(jù)到達.
 
POLLIN (對面向連接的套接字)建立連接成功
 
POLLHUP 另一端套接字發(fā)出斷開連接請求.
 
POLLHUP (僅對面向連接協(xié)議)套接字寫的時候連接斷開. 同時發(fā)送 SIGPIPE.
 
POLLOUT 套接字有充足的發(fā)送緩沖區(qū)用于寫入新數(shù)據(jù).
 
讀/寫 POLLIN|
POLLOUT
發(fā)出的 connect(2) 結(jié)束.
 
讀/寫 POLLERR 產(chǎn)生一個異步錯誤.
 
讀/寫 POLLHUP 對方已經(jīng)單向關(guān)閉連接.
 
例外 POLLPRI 緊急數(shù)據(jù)到達.然后發(fā)送 SIGURG.
 

另外一個的 poll/select 方法是讓內(nèi)核用 SIGIO 信號來通知應(yīng)用程序. 要這么用的話你必須用 fcntl(2) 設(shè)置套接字文件描述符的 FASYNC 標(biāo)志,并用 sigaction(2). 給 SIGIO 信號設(shè)置一個的有效信號處理句柄.參看下面的 SIGNALS 的討論.  

套接字選項

套接字選項可以用 setsockopt(2) 來設(shè)置,用 getsockopt(2) 讀取所有套接字級別設(shè)為 SOL_SOCKET 的套接字的套接字選項:

SO_KEEPALIVE
允許在面向連接的套接字上發(fā)送 keep-alive 消息的功能.是一個布爾整數(shù).
SO_OOBINLINE
如果打開這個選項,帶外(Out-of-Band)數(shù)據(jù)可以直接放入接收數(shù)據(jù)流。否則,只有接收時打開 MSG_OOB 標(biāo)志, 才接收帶外數(shù)據(jù).
SO_RCVLOWATSO_SNDLOWAT
聲明在開始向協(xié)議 (SO_SNDLOWAT) 或正在接收數(shù)據(jù)的用戶 (SO_RCVLOWAT). 傳遞數(shù)據(jù)之前緩沖區(qū)內(nèi)的最小字節(jié)數(shù). 在 Linux 中這兩個值是不可改變的, 固定為 1 字節(jié). 可以用 getsockopt 用來讀取它們的值; setsockopt 總是返回 ENOPROTOOPT.
SO_RCVTIMEOSO_SNDTIMEO
發(fā)送和接收時的超時設(shè)定, 并在超時時報錯. 在 Linux 中由協(xié)議指定, 不能被讀寫. 它們的功能可用 alarm(2) 或者 setitimer(2). 來模擬.
SO_BSDCOMPAT
允許 BSD 的 bug-to-bug 兼容. 這一項只能在 UDP 協(xié)議模塊中使用而且今后將要取消. 如果允許的話, UDP 套接字接收到的 ICMP 錯誤將不會被傳送至用戶程序. Linux 2.0 中對于原始套接字也允許 BSD bug-to-bug 兼容(報頭隨機改變,省略廣播標(biāo)識),但在 Linux 2.2 中取消了這一項. 修改用戶程序的方式比較好.
SO_PASSCRED
允許或關(guān)閉 SCM_CREDENTIALS 控制消息的接收. 更多信息參見 unix(7).
SO_PEERCRED
返回連接至此套接字的外部進程的身份驗證. 只在 PF_UNIX 套接字中有用.參見 unix(7). 參數(shù)為 ucred 結(jié)構(gòu).只在 getsockopt. 中有效.
SO_BINDTODEVICE
將此套接字綁定到一個特定的設(shè)備上, 如lqeth0rq, 做為指定的接口名字傳遞. 如果名稱是空字符串或此項長度為 0, 則套接字設(shè)備綁定被取消. 過去的選項是一個變長的空零結(jié)尾的接口名稱的字符串, 其最大長度為 IFNAMSIZ. 如果一個套接字被綁定至一接口, 只有由這個特定接口接收的信息包可以由此套接字處理.
SO_DEBUG
允許套接字調(diào)試.只對有 CAP_NET_ADMIN 功能或有效用戶標(biāo)識為 0 的進程有效.
SO_REUSEADDR
表示在一個 bind(2) 調(diào)用中對提供給它的地址使用的確認規(guī)則應(yīng)該允許重復(fù)使用本地地址. 對于 PF_INET 套接字, 這表示該套接字可以綁定, 除非已有一個活躍的偵聽套接口綁定到此地址上. 如果這個偵聽套接字和一個指定端口綁定為 INADDR_ANY 時, 它就不能再綁定到任何本地地址的此端口.
SO_TYPE
按整數(shù)返回套接字類型(如 SOCK_STREAM) 只能通過 getsockopt 讀取.
SO_DONTROUTE
不通過網(wǎng)關(guān)發(fā)送, 只能發(fā)送給直接連接的主機.可以通過在套接字的 send(2) 操作上設(shè)置 MSG_DONTROUTE 標(biāo)志來實現(xiàn)相同的效果. 其值為布爾型整數(shù)的標(biāo)識.
SO_BROADCAST
設(shè)置或獲取廣播標(biāo)識. 當(dāng)選擇此選項時, 數(shù)據(jù)報套接字接收向廣播地址發(fā)送的數(shù)據(jù)包, 并且可以向廣播地址發(fā)送數(shù)據(jù)包. 這一選項對于面向流的套接字無效.
SO_SNDBUF
設(shè)置或得到套接字發(fā)送緩沖區(qū)的最大字節(jié)數(shù). 其默認值由 wmem_default sysctl 設(shè)置,最大允許值由 wmem_max sysctl 設(shè)置.
SO_RCVBUF
設(shè)置或得到套接字接收緩沖區(qū)的最大字節(jié)數(shù)。其默認值由 rmem_default sysctl設(shè)置,最大允許值由 rmem_max sysctl 設(shè)置.
SO_LINGER
設(shè)置或獲取 SO_LINGER 選項的值. 其參數(shù)為 linger 結(jié)構(gòu).
struct linger {
    int   l_onoff;    /* 延時狀態(tài)(打開/關(guān)閉) */
    int   l_linger;   /* 延時多長時間 */
};

如果選擇此選項, close(2) 或 shutdown(2) 將等到所有套接字里排隊的消息成功發(fā)送或到達延遲時間后才會返回. 否則, 調(diào)用將立即返回. 而 closing 操作將在后臺進行. 如果套接字是 exit(2), 的一部分關(guān)閉時, 它總是在后臺延遲進行的.
SO_PRIORITY
設(shè)置在此套接字發(fā)送的所有包的協(xié)議定義優(yōu)先權(quán). Linux 通過這一值來排列網(wǎng)絡(luò)隊列: 根據(jù)所選設(shè)備排隊規(guī)則, 具有更高優(yōu)先權(quán)的包可以先被處理.對于 ip(7), 同時也設(shè)置了輸出包的 IP 服務(wù)類型(TOS)的域.
SO_ERROR
取得并清除未解決的套接字錯誤. 只有在 getsockopt. 時有效. 是一個整數(shù)值.

SIGNALS

當(dāng)向一個已關(guān)閉(被本地或遠程終端)的面向聯(lián)接的套接字寫入時, 將向該寫入進程發(fā)送 SIGPIPE 信號,并返回 EPIPE 如果寫入命令聲明了 MSG_NOSIGNAL 標(biāo)識時, 不會發(fā)出此信號.

如果與 FIOCSETOWN fcntl 或 SIOCSPGRP ioctl 一起請求,那么當(dāng)發(fā)生 I/O 事件時發(fā)出 SIGIO 這樣我們就可以在信號句柄里使用 poll(2) 或 select(2) 找出發(fā)生事件的套接字. 另一種選擇(在 Linux 2.2 中)是用 F_SETSIG fcntl 設(shè)置一個實時信號: 實時信號的處理程序被調(diào)用時還會收到它的 siginfo_tsi_fd 區(qū)域中的文件描述符. 更多信息參見 fcntl(2)

在某些環(huán)境中(例如:多個進程訪問單個套接字), 引發(fā) SIGIO 的東西在進程對信號作出反應(yīng)時可能已經(jīng)消失了. 如果這樣的話, 進程應(yīng)該再次等待, 因為 Linux 稍后會重發(fā)此信號.  

SYSCTLS

可以通過目錄 /proc/sys/net/core/* 下的文件或者用 sysctl(2) 系統(tǒng)調(diào)用來訪問內(nèi)核套接字的網(wǎng)絡(luò)系統(tǒng)控制(sysctl)信息.

rmem_default
指明套接字接收緩沖區(qū)的默認字節(jié)數(shù).
rmem_max
指明套接字接收緩沖區(qū)的最大字節(jié)數(shù), 用戶可以通過使用 SO_RCVBUF 套接字選項來設(shè)置此值.
wmem_default
指明套接字發(fā)送緩沖區(qū)的默認字節(jié)數(shù).
wmem_max
指明發(fā)送緩沖區(qū)的最大字節(jié)數(shù),用戶可以通過使用套接字的 SO_SNDBUF 選項來設(shè)置它的值.
message_costmessage_burst
設(shè)定記號存儲桶過濾器, 在存儲桶中保存一定數(shù)量的外部網(wǎng)絡(luò)事件導(dǎo)致的警告消息.
netdev_max_backlog
在全局輸入隊列中包的最大數(shù)目.
optmem_max
每個套接字的象 iovecs 這樣的輔助數(shù)據(jù)和用戶控制數(shù)據(jù)的最大長度.

IOCTLS

以上的 IO 控制值可以通過 ioctl(2) 來訪問:

error = ioctl(ip_socket, ioctl_type, &value_result);
SIOCGSTAMP
返回 timeval 類型的結(jié)構(gòu),其中包括有發(fā)送給用戶的最后一個包接收時的時間戳。被用來測量精確的 RTT (round trip time) 時間. struct timeval. 結(jié)構(gòu)說明請參考 setitimer(2)
SIOCSPGRP
在異步 IO 操作結(jié)束或者接收到緊急數(shù)據(jù)時,用來設(shè)置進程或進程組,向它(它們)發(fā)送 SIGIO 或者 SIGURG 信號, 參數(shù)為指向 pid_t. 類型的指針。如果參數(shù)為正,則發(fā)送信號到相應(yīng)的進程。如果參數(shù)為負,則發(fā)送信號到此參數(shù)絕對值 id 所屬的進程組的所有進程。如果它沒有 CAP_KILL 功能或者它的有效 UID 不是 0, 進程只能選擇它自己或自己的進程組來接收信號.
FIOASYNC
改變 O_ASYNC 標(biāo)志來打開或者關(guān)閉套接字的異步 IO 模式。異步IO模式指的是:當(dāng)新的 I/O 事件發(fā)生時,將發(fā)出 SIGIO 信號或者用 F_SETSIG 設(shè)置的信號.
參數(shù)為整形布爾量.
SIOCGPGRP
獲得當(dāng)前接收 SIGIO 或者 SIGURG 信號的進程或者進程組, 如果兩個信號都沒有設(shè)置, 則為 0.

有效的 fcntl:

FIOCGETOWN
與 IO 控制中的 SIOCGPGRP 相同.
FIOCSETOWN
與 IO 控制中的 SIOCSPGRP 相同.

注意

Linux 假設(shè)有一半的發(fā)送/接收緩沖區(qū)是用來處理內(nèi)核結(jié)構(gòu), 因此, 系統(tǒng)控制的緩沖區(qū)是網(wǎng)絡(luò)可訪問的緩沖區(qū)的兩倍.  

缺陷

CONFIG_FILTER 沒有介紹 SO_ATTACH_FILTER SO_DETACH_FILTER 套接字選項. 在 libpcap 庫有此接口的說明  

VERSIONS 版本

SO_BINDTODEVICE 在 Linux 2.0.30 中引入. SO_PASSCRED 是在 Linux 2.2 中引入的新選項. sysctl 是在 Linux 2.2. 中引入的新概念。  

作者

本手冊頁由 Andi Kleen 編寫.

又見

socket(2), ip(7), setsockopt(2), getsockopt(2), packet(7), ddp(7)

#p#

NAME

socket - Linux socket interface  

SYNOPSIS

#include <sys/socket.h>
mysocket = socket(int socket_family, int socket_type, int protocol);

DESCRIPTION

This manual page describes the Linux networking socket layer user interface. The BSD compatible sockets are the uniform interface between the user process and the network protocol stacks in the kernel. The protocol modules are grouped into protocol families like PF_INET, PF_IPX, PF_PACKET and socket types like SOCK_STREAM or SOCK_DGRAM. See socket(2) for more information on families and types.

SOCKET LAYER FUNCTIONS

These functions are used by the user process to send or receive packets and to do other socket operations. For more information see their respective manual pages.

socket(2) creates a socket, connect(2) connects a socket to a remote socket address, the bind(2) function binds a socket to a local socket address, listen(2) tells the socket that new connections shall be accepted, and accept(2) is used to get a new socket with a new incoming connection. socketpair(2) returns two connected anonymous sockets (only implemented for a few local families like PF_UNIX)

send(2), sendto(2), and sendmsg(2) send data over a socket, and recv(2), recvfrom(2), recvmsg(2) receive data from a socket. poll(2) and select(2) wait for arriving data or a readiness to send data. In addition, the standard I/O operations like write(2), writev(2), sendfile(2), read(2), and readv(2) can be used to read and write data.

getsockname(2) returns the local socket address and getpeername(2) returns the remote socket address. getsockopt(2) and setsockopt(2) are used to set or get socket layer or protocol options. ioctl(2) can be used to set or read some other options.

close(2) is used to close a socket. shutdown(2) closes parts of a full duplex socket connection.

Seeking, or calling pread(2) or pwrite(2) with a non-zero position is not supported on sockets.

It is possible to do non-blocking IO on sockets by setting the O_NONBLOCK flag on a socket file descriptor using fcntl(2). Then all operations that would block will (usually) return with EAGAIN (operation should be retried later); connect(2) will return EINPROGRESS error. The user can then wait for various events via poll(2) or select(2).

I/O events
 
Event Poll flag Occurrence
 
Read POLLIN New data arrived.
 
Read POLLIN A connection setup has been completed (for connection-oriented sockets)
 
Read POLLHUP A disconnection request has been initiated by the other end.
 
Read POLLHUP A connection is broken (only for connection-oriented protocols). When the socket is written SIGPIPE is also sent.
 
Write POLLOUT Socket has enough send buffer space for writing new data.
 
Read/Write POLLIN|
POLLOUT
An outgoing connect(2) finished.
 
Read/Write POLLERR An asynchronous error occurred.
 
Read/Write POLLHUP The other end has shut down one direction.
 
Exception POLLPRI Urgent data arrived. SIGURG is sent then.
 

An alternative to poll/select is to let the kernel inform the application about events via a SIGIO signal. For that the FASYNC flag must be set on a socket file descriptor via fcntl(2) and a valid signal handler for SIGIO must be installed via sigaction(2). See the SIGNALS discussion below.  

SOCKET OPTIONS

These socket options can be set by using setsockopt(2) and read with getsockopt(2) with the socket level set to SOL_SOCKET for all sockets:

SO_KEEPALIVE
Enable sending of keep-alive messages on connection-oriented sockets. Expects a integer boolean flag.
SO_OOBINLINE
If this option is enabled, out-of-band data is directly placed into the receive data stream. Otherwise out-of-band data is only passed when the MSG_OOB flag is set during receiving.
SO_RCVLOWAT and SO_SNDLOWAT
Specify the minimum number of bytes in the buffer until the socket layer will pass the data to the protocol (SO_SNDLOWAT) or the user on receiving (SO_RCVLOWAT). These two values are not changeable in Linux and their argument size is always fixed to 1 byte. getsockopt is able to read them; setsockopt will always return ENOPROTOOPT.
SO_RCVTIMEO and SO_SNDTIMEO
Specify the receiving or sending timeouts until reporting an error. The parameter is a struct timeval. If an input or output function blocks for this period of time, and data has been sent or received, the return value of that function will be the amount of data transferred; if no data has been transferred and the timeout has been reached then -1 is returned with errno set to EAGAIN or EWOULDBLOCK just as if the socket was specified to be nonblocking. If the timeout is set to zero (the default) then the operation will never timeout.
SO_BSDCOMPAT
Enable BSD bug-to-bug compatibility. This is used only by the UDP protocol module and scheduled to be removed in future. If enabled ICMP errors received for a UDP socket will not be passed to the user program. Linux 2.0 also enabled BSD bug-to-bug compatibility options (random header changing, skipping of the broadcast flag) for raw sockets with this option, but that has been removed in Linux 2.2. It is better to fix the user programs than to enable this flag.
SO_PASSCRED
Enable or disable the receiving of the SCM_CREDENTIALS control message. For more information see unix(7).
SO_PEERCRED
Return the credentials of the foreign process connected to this socket. Only useful for PF_UNIX sockets; see unix(7). Argument is a ucred structure. Only valid as a getsockopt.
SO_BINDTODEVICE
Bind this socket to a particular device like lqeth0rq, as specified in the passed interface name. If the name is an empty string or the option length is zero, the socket device binding is removed. The passed option is a variable-length null terminated interface name string with the maximum size of IFNAMSIZ. If a socket is bound to an interface, only packets received from that particular interface are processed by the socket. Note that this only works for some socket types, particularly AF_INET sockets. It is not supported for packet sockets (use normal bind(8) there).
SO_DEBUG
Enable socket debugging. Only allowed for processes with the CAP_NET_ADMIN capability or an effective user id of 0.
SO_REUSEADDR
Indicates that the rules used in validating addresses supplied in a bind(2) call should allow reuse of local addresses. For PF_INET sockets this means that a socket may bind, except when there is an active listening socket bound to the address. When the listening socket is bound to INADDR_ANY with a specific port then it is not possible to bind to this port for any local address.
SO_TYPE
Gets the socket type as an integer (like SOCK_STREAM). Can only be read with getsockopt.
SO_ACCEPTCONN
Returns a value indicating whether or not this socket has been marked to accept connections with listen(). The value 0 indicates that this is not a listening socket, the value 1 indicates that this is a listening socket. Can only be read with getsockopt.
SO_DONTROUTE
Don't send via a gateway, only send to directly connected hosts. The same effect can be achieved by setting the MSG_DONTROUTE flag on a socket send(2) operation. Expects an integer boolean flag.
SO_BROADCAST
Set or get the broadcast flag. When enabled, datagram sockets receive packets sent to a broadcast address and they are allowed to send packets to a broadcast address. This option has no effect on stream-oriented sockets.
SO_SNDBUF
Sets or gets the maximum socket send buffer in bytes. The default value is set by the wmem_default sysctl and the maximum allowed value is set by the wmem_max sysctl.
SO_RCVBUF
Sets or gets the maximum socket receive buffer in bytes. The default value is set by the rmem_default sysctl and the maximum allowed value is set by the rmem_max sysctl.
SO_LINGER
Sets or gets the SO_LINGER option. The argument is a linger structure.
struct linger {
    int   l_onoff;    /* linger active */
    int   l_linger;   /* how many seconds to linger for */
};

When enabled, a close(2) or shutdown(2) will not return until all queued messages for the socket have been successfully sent or the linger timeout has been reached. Otherwise, the call returns immediately and the closing is done in the background. When the socket is closed as part of exit(2), it always lingers in the background.
SO_PRIORITY
Set the protocol-defined priority for all packets to be sent on this socket. Linux uses this value to order the networking queues: packets with a higher priority may be processed first depending on the selected device queueing discipline. For ip(7), this also sets the IP type-of-service (TOS) field for outgoing packets.
SO_ERROR
Get and clear the pending socket error. Only valid as a getsockopt. Expects an integer.

SIGNALS

When writing onto a connection-oriented socket that has been shut down (by the local or the remote end) SIGPIPE is sent to the writing process and EPIPE is returned. The signal is not sent when the write call specified the MSG_NOSIGNAL flag.

When requested with the FIOSETOWN fcntl or SIOCSPGRP ioctl, SIGIO is sent when an I/O event occurs. It is possible to use poll(2) or select(2) in the signal handler to find out which socket the event occurred on. An alternative (in Linux 2.2) is to set a realtime signal using the F_SETSIG fcntl; the handler of the real time signal will be called with the file descriptor in the si_fd field of its siginfo_t. See fcntl(2) for more information.

Under some circumstances (e.g. multiple processes accessing a single socket), the condition that caused the SIGIO may have already disappeared when the process reacts to the signal. If this happens, the process should wait again because Linux will resend the signal later.  

SYSCTLS

The core socket networking sysctls can be accessed using the /proc/sys/net/core/* files or with the sysctl(2) interface.

rmem_default
contains the default setting in bytes of the socket receive buffer.
rmem_max
contains the maximum socket receive buffer size in bytes which a user may set by using the SO_RCVBUF socket option.
wmem_default
contains the default setting in bytes of the socket send buffer.
wmem_max
contains the maximum socket send buffer size in bytes which a user may set by using the SO_SNDBUF socket option.
message_cost and message_burst
configure the token bucket filter used to load limit warning messages caused by external network events.
netdev_max_backlog
Maximum number of packets in the global input queue.
optmem_max
Maximum length of ancillary data and user control data like the iovecs per socket.

IOCTLS

These ioctls can be accessed using ioctl(2):

error = ioctl(ip_socket, ioctl_type, &value_result);
SIOCGSTAMP
Return a struct timeval with the receive timestamp of the last packet passed to the user. This is useful for accurate round trip time measurements. See setitimer(2) for a description of struct timeval.
SIOCSPGRP
Set the process or process group to send SIGIO or SIGURG signals to when an asynchronous I/O operation has finished or urgent data is available. The argument is a pointer to a pid_t. If the argument is positive, send the signals to that process. If the argument is negative, send the signals to the process group with the id of the absolute value of the argument. The process may only choose itself or its own process group to receive signals unless it has the CAP_KILL capability or an effective UID of 0.
FIOASYNC
Change the O_ASYNC flag to enable or disable asynchronous IO mode of the socket. Asynchronous IO mode means that the SIGIO signal or the signal set with F_SETSIG is raised when a new I/O event occurs.
Argument is a integer boolean flag.
SIOCGPGRP
Get the current process or process group that receives SIGIO or SIGURG signals, or 0 when none is set.

Valid fcntls:

FIOGETOWN
The same as the SIOCGPGRP ioctl.
FIOSETOWN
The same as the SIOCSPGRP ioctl

NOTES

Linux assumes that half of the send/receive buffer is used for internal kernel structures; thus the sysctls are twice what can be observed on the wire.  

BUGS

The CONFIG_FILTER socket options SO_ATTACH_FILTER and SO_DETACH_FILTER are not documented. The suggested interface to use them is via the libpcap library.  

VERSIONS

SO_BINDTODEVICE was introduced in Linux 2.0.30. SO_PASSCRED is new in Linux 2.2. The sysctls are new in Linux 2.2. SO_RCVTIMEO and SO_SNDTIMEO are supported since Linux 2.3.41. Earlier, timeouts were fixed to a protocol specific setting, and could not be read or written.  

SEE ALSO

socket(2), ip(7), setsockopt(2), getsockopt(2), packet(7), ddp(7)

責(zé)任編輯:韓亞珊 來源: CMPP.net
相關(guān)推薦

2011-08-15 10:21:09

man中文man

2011-08-24 16:48:36

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-11 15:03:21

ACCESS中文man

2011-08-11 15:28:43

ali中文man

2011-08-11 16:31:49

biff中文man

2011-08-11 17:16:43

cce中文man

2011-08-11 18:05:04

chvt中文man

2011-08-11 18:13:07

clear中文man

2011-08-12 09:13:02

df中文man

2011-08-12 09:38:06

dircolors中文man

2011-08-12 09:44:37

dirname中文man

2011-08-12 10:20:02

echo中文man

2011-08-12 10:25:55

eject中文man

2011-08-12 11:07:19

git中文man

2011-08-12 13:18:19

head中文man

2011-08-12 13:49:23

hostid中文man

2011-08-12 13:54:46

hostname中文man

2011-08-12 14:53:56

kill中文man
點贊
收藏

51CTO技術(shù)棧公眾號

主站蜘蛛池模板: 国产日韩一区 | 国产偷自视频区视频 | 欧美三级三级三级爽爽爽 | 久久黄网 | 亚洲欧美成人 | 国产精品欧美一区二区 | 成人精品一区二区三区中文字幕 | 亚洲综合二区 | 亚洲国产在 | 综合久久综合久久 | 午夜理伦三级理论三级在线观看 | 日韩精品亚洲专区在线观看 | 欧美日韩在线免费观看 | 亚洲精品一区久久久久久 | 国产精品揄拍一区二区 | 国产综合久久 | 国产一级在线 | 中国一级大毛片 | 久久99精品久久久久子伦 | 很黄很污的网站 | 中文字幕亚洲区一区二 | 黄免费观看视频 | 99精品视频免费观看 | 国产亚洲精品成人av久久ww | 国产女人第一次做爰毛片 | 狠狠草视频 | 超碰在线免费 | 国产日韩欧美一区二区 | 一区二区三区亚洲视频 | 久久亚洲国产精品日日av夜夜 | 狠狠色狠狠色综合日日92 | 中文字幕免费视频 | 国产亚洲一区二区精品 | 精品日韩| 成人精品福利 | 欧美精品久久久 | 91网视频 | 国产精品福利网站 | 欧美日韩高清在线观看 | 狠狠色综合欧美激情 | 亚洲人成人网 |