set_socket_paramT_set_socket_paramSetSocketParamSetSocketParamset_socket_param (算子)
名称
set_socket_paramT_set_socket_paramSetSocketParamSetSocketParamset_socket_param — 设置套接字参数。
签名
描述
set_socket_paramset_socket_paramSetSocketParamSetSocketParamSetSocketParamset_socket_param sets the GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name
according to GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value for the specified socket connection.
Available parameters are 'timeout'"timeout""timeout""timeout""timeout""timeout", 'SO_SNDBUF'"SO_SNDBUF""SO_SNDBUF""SO_SNDBUF""SO_SNDBUF""SO_SNDBUF",
'SO_RCVBUF'"SO_RCVBUF""SO_RCVBUF""SO_RCVBUF""SO_RCVBUF""SO_RCVBUF", 'SO_BROADCAST'"SO_BROADCAST""SO_BROADCAST""SO_BROADCAST""SO_BROADCAST""SO_BROADCAST", and 'TCP_NODELAY'"TCP_NODELAY""TCP_NODELAY""TCP_NODELAY""TCP_NODELAY""TCP_NODELAY".
The parameter 'timeout'"timeout""timeout""timeout""timeout""timeout" can be used to set a timeout
for this socket. The timeout is given in seconds as a floating point
number or as the string 'infinite'"infinite""infinite""infinite""infinite""infinite".
The parameters starting with 'SO_' or 'TCP_' set the corresponding socket
options. 'SO_SNDBUF'"SO_SNDBUF""SO_SNDBUF""SO_SNDBUF""SO_SNDBUF""SO_SNDBUF" and 'SO_RCVBUF'"SO_RCVBUF""SO_RCVBUF""SO_RCVBUF""SO_RCVBUF""SO_RCVBUF" specify the
size of the send respectively receive buffer of the operating system
for this socket. Please be aware that this does not mean the size
of one network packet but the size of the buffers where all packets are
temporarily stored by your operating system.
'SO_BROADCAST'"SO_BROADCAST""SO_BROADCAST""SO_BROADCAST""SO_BROADCAST""SO_BROADCAST" can only be used together with UDP connections
and enables broadcasting of network packets.
'TCP_NODELAY'"TCP_NODELAY""TCP_NODELAY""TCP_NODELAY""TCP_NODELAY""TCP_NODELAY" controls the Nagle algorithm, which optimizes the
flow of small TCP packets and can only be used with TCP connections.
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
SocketSocketSocketSocketsocketsocket (输入控制) socket → HSocket, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Socket number.
GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (输入控制) string(-array) → HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Name of the socket parameter.
值列表:
'SO_BROADCAST'"SO_BROADCAST""SO_BROADCAST""SO_BROADCAST""SO_BROADCAST""SO_BROADCAST", 'SO_RCVBUF'"SO_RCVBUF""SO_RCVBUF""SO_RCVBUF""SO_RCVBUF""SO_RCVBUF", 'SO_SNDBUF'"SO_SNDBUF""SO_SNDBUF""SO_SNDBUF""SO_SNDBUF""SO_SNDBUF", 'TCP_NODELAY'"TCP_NODELAY""TCP_NODELAY""TCP_NODELAY""TCP_NODELAY""TCP_NODELAY", 'timeout'"timeout""timeout""timeout""timeout""timeout"
GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value (输入控制) string(-array) → HTupleMaybeSequence[Union[float, int, str]]HTupleHtuple (string / real / integer) (string / double / int / long) (HString / double / Hlong) (char* / double / Hlong)
Value of the socket parameter.
默认值:
'on'
"on"
"on"
"on"
"on"
"on"
建议值:
'on'"on""on""on""on""on", 'off'"off""off""off""off""off", 0, 1, 3.0, 'infinite'"infinite""infinite""infinite""infinite""infinite", 530, 1460
可能的前趋
open_socket_connectopen_socket_connectOpenSocketConnectOpenSocketConnectOpenSocketConnectopen_socket_connect,
socket_accept_connectsocket_accept_connectSocketAcceptConnectSocketAcceptConnectSocketAcceptConnectsocket_accept_connect
可能的后继
send_datasend_dataSendDataSendDataSendDatasend_data,
receive_datareceive_dataReceiveDataReceiveDataReceiveDatareceive_data
另见
get_socket_paramget_socket_paramGetSocketParamGetSocketParamGetSocketParamget_socket_param
模块
基础