# OpcClient.State Property

> Reference: Gets a value that indicates the current state of the client regarding its channel used to communicate with the endpoint defined by ServerAddress and EndpointPolicy setup via Security.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcClient</a></dd>
<dt>Namespace</dt>
<dd><a href="../namespaces/opc.uafx.client">Opc.UaFx.Client</a></dd>
<dt>Assembly</dt>
<dd>Opc.UaFx.Advanced.dll</dd>
<dt>Package</dt>
<dd>Opc.UaFx.Advanced v2.59.0</dd>
<dt>Members</dt>
<dd><a href="./members">OpcClient Members</a></dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

Gets a value that indicates the current state of the client regarding its channel used to communicate with the endpoint defined by [ServerAddress](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclient/serveraddress) and [EndpointPolicy](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclientsecurity/members#endpointpolicy) setup via [Security](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationinstance-2/members#security).

<div class="api-signature" data-lang="csharp">

```csharp
public OpcClientState State { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public ReadOnly Property State As OpcClientState
```

</div>

**Property value**

[OpcClientState](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclientstate/)

One of the members defined by the [OpcClientState](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclientstate/) enumeration. Which specifies the current state of the client. The initial value of this property is [Created](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclientstate/#created). Any subsequent transition of the value of this property will never change the value of this property back to its initial value (= [Created](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclientstate/#created)).

**Remarks**

Depending on the current state different actions are either allowed, disallowed or functional on the current [OpcClient](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclient/) instance.

A lost connection is detected by a failing keep-alive of the session or by a service call that fails because the channel or the session is gone, for example with [BadConnectionClosed](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badconnectionclosed) or, after the server restarted, [BadSessionIdInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badsessionidinvalid). Then the client changes to [Reconnecting](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclientstate/#reconnecting) and reconnects if [ReconnectInterval](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclient/reconnectinterval) is greater than zero, or changes to [Disconnected](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclientstate/#disconnected) and raises [BreakDetected](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclient/breakdetected) otherwise, both before the failing call returns. This requires [UseBreakDetection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclient/usebreakdetection), which is enabled by default.

While the server cannot be reached at all, a service call waits for the operation timeout before it fails, and the keep-alive detects the break in the meantime.
