Perl 設定套接字選項函式



說明

此函式在指定級別的 SOCKET 上利用 OPTVAL 給 OPTNAME 套接字選項設定值。如下文表格中所示,你需要匯入套接字模組來獲取 OPTNAME 的有效值

語法

以下是此函式的簡單語法 -

setsockopt SOCKET, LEVEL, OPTNAME, OPTVAL

返回值

此函式在失敗時返回未定義,在成功時返回 1。

OPTNAME 	Description
SO_DEBUG 	Enable/disable recording of debugging information.
SO_REUSEADDR 	Enable/disable local address reuse.
SO_KEEPALIVE 	Enable/disable keep connections alive.
SO_DONTROUTE 	Enable/disable routing bypass for outgoing messages.
SO_LINGER 	Linger on close if data is present.
SO_BROADCAST 	Enable/disable permission to transmit broadcast messages.
SO_OOBINLINE 	Enable/disable reception of out-of-band data in band.
SO_SNDBUF 	Set buffer size for output.
SO_RCVBUF 	Set buffer size for input.
SO_TYPE 	Get the type of the socket (get only).
SO_ERROR 	Get and clear error on the socket (get only).
perl_function_references.htm
廣告
© . All rights reserved.