Share via


Socket Constructor

Initializes a new instance of the Socket class.

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

Syntax

public Socket (
         AddressFamilyaddressFamily,
         SocketTypesocketType,
         ProtocolTypeprotocolType
)

Parameters

  • addressFamily
    A value of the AddressFamily enumeration specifying the addressing scheme that the current socket uses to resolve an address.
  • socketType
    A value of the SocketType enumeration specifying the socket's type, which defines the current socket's capabilities.
  • protocolType
    A value of the ProtocolType enumeration specifying the communications protocol that the current socket uses.

Remarks

The addressFamily, socketType, and protocolType parameters are not independent. Some address families dictate which protocols can and cannot 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 object, this constructor throws an exception that is specified by a SocketException object.

Version Information

Available in .NET Micro Framework version 2.0, 2.5

See Also

Reference

Socket Class
Socket Members
System.Net.Sockets Namespace