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

◆ socket() [5/5]

xtd::net::sockets::socket::socket ( xtd::net::sockets::address_family  address_family,
xtd::net::sockets::socket_type  socket_type,
xtd::net::sockets::protocol_type  protocol_type 
)

Initializes a new instance of the xtd::net::sockets::socket class using the specified address family, socket type and protocol.

Parameters
address_familyOne of the xtd::net::sockets::address_family values.
socket_typeOne of the xtd::net::sockets::socket_type values.
protocol_typeOne of the xtd::net::sockets::protocol_type values.
Exceptions
xtd::net:sockets::socket_exceptionThe combination of address_family, socket_type and protocol_type results in an invalid socket.
Remarks
The address_family parameter specifies the addressing scheme that the xtd::net::sockets::socket class uses, the socket_type parameter specifies the type of the xtd::net::sockets::socket class, and the protocol_type parameter specifies the protocol used by xtd::net::sockets::socket. The three parameters are not independent. Some address families restrict which protocols can be used with them, and often the xtd::net::sockets::socket type is implicit in the protocol. If the combination of address family, xtd::net::sockets::socket type, and protocol type results in an invalid xtd::net::sockets::socket, this constructor throws a xtd::net::sockets::socket_exception.
Note
If this constructor throws a xtd::net::sockets::socket_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 for a detailed description of the error.