Socket.AddressFamily Property


Gets the address family of the Socket.

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

Public ReadOnly Property AddressFamily As AddressFamily

Property Value

Type: System.Net.Sockets.AddressFamily

One of the AddressFamily values.

The AddressFamily specifies the addressing scheme that an instance of the Socket class can use. This property is read-only and is set when the Socket is created.

The following code example displays the AddressFamily, SocketType, and ProtocolType to the console.

Dim s As New Socket(lep.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp)

'Using the AddressFamily, SocketType, and ProtocolType properties.
Console.WriteLine(("I just set the following properties of socket: " + "Address Family = " + s.AddressFamily.ToString() + ControlChars.Cr + "SocketType = " + s.SocketType.ToString() + ControlChars.Cr + "ProtocolType = " + s.ProtocolType.ToString()))

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Available since 2.0
Windows Phone Silverlight
Available since 7.1
Return to top