# OpcClient.DenyIfNotConnected Method

<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>

<span class="api-meta">protected</span>

Verifies whether the client is connected to the server.

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

```csharp
protected void DenyIfNotConnected()
```

</div>

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

```vbnet
Protected Sub DenyIfNotConnected()
```

</div>

**Exceptions**

| Exception | Condition |
|---|---|
| [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) | The client is not connected to the server. |
