Freigeben über


SocketType Enumeration

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Specifies the type of socket that an instance of the Socket class represents.

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

Syntax

'Declaration
Public Enumeration SocketType
public enum SocketType

Members

Member name Description
Supported by Silverlight for Windows Phone Stream A socket type that supports reliable, two-way, connection-based byte streams without the duplication of data and without preservation of boundaries. A Socket of this type communicates with a single peer and requires a remote host connection before communication can begin. This socket type uses the Transmission Control Protocol (Tcp) and the AddressFamily.can be either InterNetwork or InterNetworkV6.
Supported by Silverlight for Windows Phone Unknown An unknown Socket type.
Supported by Silverlight for Windows Phone Dgram Supports datagrams, which are connectionless, unreliable messages of a fixed (typically small) maximum length. Messages might be lost or duplicated and might arrive out of order. A Socket of type Dgram requires no connection prior to sending and receiving data, and can communicate with multiple peers. Dgram uses the Datagram Protocol (Udp) and the InterNetwork or InterNetworkV6AddressFamily. Not a supported value for Silverlight for the desktop.

Remarks

Before a Socket can send and receive data, it must first be created using an AddressFamily, a SocketType, and a ProtocolType. The SocketType enumeration provides several options for defining the type of Socket that you intend to open.

NoteNote:

SocketType will sometimes implicitly indicate which ProtocolType will be used within an AddressFamily. For example when the SocketType is Stream, the ProtocolType is always Tcp. If you try to create a Socket with an incompatible combination, Socket will throw a SocketException.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference