xtd 0.2.0
Loading...
Searching...
No Matches

◆ set_socket_option() [2/5]

void xtd::net::sockets::socket::set_socket_option ( xtd::net::sockets::socket_option_level  socket_option_level,
xtd::net::sockets::socket_option_name  socket_option_name,
int32  option_value 
)

Sets the specified xtd::net::sockets::socket option to the specified integer value.

Parameters
socket_option_levelOne of the xtd::net::sockets::socket_option_level values.
socket_option_nameOne of the xtd::net::sockets::socket_option_name values.
option_valueA value of the option.
Exceptions
xtd::net::sockets::socket_exceptionAn error occurred when attempting to access the socket.
xtd::object_closed_exceptionThe xtd::net::sockets::socket has been closed.
Remarks
xtd::net::sockets::socket options determine the behavior of the current xtd::net::sockets::socket. For an option with a bool data type, specify a nonzero value to enable the option, and a zero value to disable the option. For an option with an int data type, specify the appropriate value. xtd::net::sockets::socket options are grouped by level of protocol support.
Listed below are the various xtd::net::sockets::socket options that can be set using this overload. These options are grouped by the appropriate xtd::net::sockets::socket_option_level. If you intend to set any of these options, be sure to use the appropriate xtd::net::sockets::socket_option_level for the optionLevel parameter. The option you choose to set must be specified in the option_ame parameter. If you want to get the current value of any of the options listed, use the xtd::net::sockets::socket::get_socket_option method.

For more information on these options, refer to the xtd::net::sockets::socket_option_name enumeration.
Note
If you receive a xtd::net::sockets::socket_exception exception, use the xtd::net::sockets::socket_exception::error_code property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.