当前位置:首页 » Perl » perl setsockopt()函数

perl setsockopt()函数

perl setsockopt()函数例子,setsockopt()函数实例代码 - 设置套接字选项OPTNAME,在指定的级别上SOCKET值OPTVAL。

语法

setsockopt SOCKET, LEVEL, OPTNAME, OPTVAL


定义和用法

设置套接字选项OPTNAME,在指定的级别上SOCKET值OPTVAL。有效值OPTNAME,您将需要进口的Socket模块,如下表所示,

返回值

  • undef - 失败时

  • 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).