Socket Constructor

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Initializes a new instance of the Socket class using the specified address family, socket type and protocol.

Namespace:  System.Net.Sockets
Assembly:  System (in System.dll)

public:
Socket(
	AddressFamily addressFamily, 
	SocketType socketType, 
	ProtocolType protocolType
)

Parameters

addressFamily
Type: System.Net.Sockets..::..AddressFamily
One of the AddressFamily values.
socketType
Type: System.Net.Sockets..::..SocketType
One of the SocketType values.
protocolType
Type: System.Net.Sockets..::..ProtocolType
One of the ProtocolType values.

The addressFamily parameter specifies the addressing scheme that the Socket class uses, the socketType parameter specifies the type of the Socket class, and the protocolType parameter specifies the protocol used by Socket. The three parameters are not independent. Some address families restrict which protocols can be used with them, and often the Socket type is implicit in the protocol. If the combination of address family, Socket type, and protocol type results in an invalid Socket, this constructor throws a SocketException.

Show: