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
- 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.
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.