Socket.SocketType Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the type of the Socket.

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

public SocketType SocketType { get; }

Property Value

Type: System.Net.Sockets.SocketType

One of the SocketType values.

SocketType is read-only and is set when the Socket is created.

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

Socket s = 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 () + "\nSocketType = " + s.SocketType.ToString () + "\nProtocolType = " + s.ProtocolType.ToString ());

.NET Framework
Available since 1.1
Return to top
Show: