當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


Perl setsockopt用法及代碼示例



描述

此函數將套接字選項 OPTNAME 設置為指定 LEVEL 上 SOCKET 上的 OPTVAL 值。您將需要導入 Socket 模塊以獲得下表中顯示的 OPTNAME 的有效值

用法

以下是此函數的簡單語法 âˆ'

setsockopt SOCKET, LEVEL, OPTNAME, OPTVAL

返回值

此函數在失敗時返回 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).

相關用法


注:本文由純淨天空篩選整理自 Perl setsockopt Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。