Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Socket.Connected Property

Gets a value that indicates whether a Socket is connected to a remote host as of the last operation.

Namespace:  System.Net.Sockets
Assembly:  System.Net (in System.Net.dll)
public bool Connected { get; }

Property Value

Type: System.Boolean
true if the Socket was connected to a remote resource as of the most recent operation; otherwise, false.

The Connected property gets the connection state of the Socket as of the last I/O operation. When it returns false, the Socket was either never connected, or is no longer connected.

The value of the Connected property reflects the state of the connection as of the most recent operation. The last ConnectAsync, ReceiveAsync, or SendAsync operation determines the current state. If you need to determine the current state of the connection, make a zero-byte SendAsync call. If the call completes successfully, then the socket is still connected; otherwise, the socket is no longer connected.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.