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.