Skip to content

set_socket_paramSetSocketParamSetSocketParamset_socket_paramT_set_socket_param🔗

Short description🔗

set_socket_paramSetSocketParamSetSocketParamset_socket_paramT_set_socket_param — Set a socket parameter.

Signature🔗

set_socket_param( socket Socket, string GenParamName, string GenParamValue )void SetSocketParam( const HTuple& Socket, const HTuple& GenParamName, const HTuple& GenParamValue )static void HOperatorSet.SetSocketParam( HTuple socket, HTuple genParamName, HTuple genParamValue )def set_socket_param( socket: HHandle, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[float, int, str]] ) -> None

Herror T_set_socket_param( const Htuple Socket, const Htuple GenParamName, const Htuple GenParamValue )

void HSocket::SetSocketParam( const HTuple& GenParamName, const HTuple& GenParamValue ) const

void HSocket::SetSocketParam( const HString& GenParamName, const HString& GenParamValue ) const

void HSocket::SetSocketParam( const char* GenParamName, const char* GenParamValue ) const

void HSocket::SetSocketParam( const wchar_t* GenParamName, const wchar_t* GenParamValue ) const (Windows only)

void HSocket.SetSocketParam( HTuple genParamName, HTuple genParamValue )

void HSocket.SetSocketParam( string genParamName, string genParamValue )

Description🔗

set_socket_paramSetSocketParam sets the GenParamNamegenParamNamegen_param_name according to GenParamValuegenParamValuegen_param_value for the specified socket connection. Available parameters are 'timeout'"timeout", 'SO_SNDBUF'"SO_SNDBUF", 'SO_RCVBUF'"SO_RCVBUF", 'SO_BROADCAST'"SO_BROADCAST", and 'TCP_NODELAY'"TCP_NODELAY".

The parameter '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".

The parameters starting with ‘SO_’ or ‘TCP_’ set the corresponding socket options. 'SO_SNDBUF'"SO_SNDBUF" and '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" can only be used together with UDP connections and enables broadcasting of network packets. 'TCP_NODELAY'"TCP_NODELAY" controls the Nagle algorithm, which optimizes the flow of small TCP packets and can only be used with TCP connections.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

Socketsocketsocket (input_control) socket → (handle)HTuple (HHandle)HSocket, HTuple (IntPtr)HHandleHtuple (handle)

Socket number.

GenParamNamegenParamNamegen_param_name (input_control) string(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Name of the socket parameter.

List of values: 'SO_BROADCAST', 'SO_RCVBUF', 'SO_SNDBUF', 'TCP_NODELAY', 'timeout'"SO_BROADCAST", "SO_RCVBUF", "SO_SNDBUF", "TCP_NODELAY", "timeout"

GenParamValuegenParamValuegen_param_value (input_control) string(-array) → (string / real / integer)HTuple (HString / double / Hlong)HTuple (string / double / int / long)MaybeSequence[Union[float, int, str]]Htuple (char* / double / Hlong)

Value of the socket parameter.

Default: 'on'"on"
Suggested values: 'on', 'off', 0, 1, 3.0, 'infinite', 530, 1460"on", "off", 0, 1, 3.0, "infinite", 530, 1460

Combinations with other operators🔗

Combinations

Possible predecessors

open_socket_connectOpenSocketConnect, socket_accept_connectSocketAcceptConnect

Possible successors

send_dataSendData, receive_dataReceiveData

See also

get_socket_paramGetSocketParam

Module🔗

Foundation