Share via


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)

Syntax

'Declaration
Public Sub New ( _
    addressFamily As AddressFamily, _
    socketType As SocketType, _
    protocolType As ProtocolType _
)
public Socket(
    AddressFamily addressFamily,
    SocketType socketType,
    ProtocolType protocolType
)
public:
Socket(
    AddressFamily addressFamily, 
    SocketType socketType, 
    ProtocolType protocolType
)
new : 
        addressFamily:AddressFamily * 
        socketType:SocketType * 
        protocolType:ProtocolType -> Socket
public function Socket(
    addressFamily : AddressFamily, 
    socketType : SocketType, 
    protocolType : ProtocolType
)

Parameters

Remarks

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.

.NET Framework Security

See Also

Reference

Socket Class

System.Net.Sockets Namespace