ConnectionState Enumeration

Extracted nested table 0

AdsErrorCode

Description

WSA_ConnRefused

The target computer actively refused the socket connection.

PortDisabled

The target port is disabled.

PortNotConnected

The target port is not connected.

ClientSyncTimeOut

The target system didn't answer within the configured timeout timespan.

TargetMachineNotFound

The target machine was not found.

TargetPortNotFound

The ADS target port couldn't be found on the target address.

ClientPortNotOpen

The ADS target port on the target address is not open.

Connection state enumeration

Namespace:  TwinCAT
Assembly:  TwinCAT.Ads.Abstractions (in TwinCAT.Ads.Abstractions.dll) Version: 6.0.328+39e3229

Syntax

C#

public enum ConnectionState

Members

 

Member name

Value

Description

None

0

Unknown / Uninitialized

Disconnected

1

Disconnected

Connected

2

Connected

Lost

3

Connection lost

The connection is (temporarily) lost and can be reestablished / resurrected after a (resurrection) timeout.

During ADS communication, specific AdsErrorCode responses lead to so called 'Tripping Errors' that triggers the change from Connected to Lost. This is a behavior of the internal ConnectionStateInterceptor that observes the condition of the actual connection and can be configured via the session settings. So called tripping errors are the following:see "Extracted nested table 0"

All theses described ADS error lead to lost connection state. Depending on the configured communication interceptor / or Session settings the ConnectionState returns to Connected under the following conditions:

  • An ADS communication is triggered (Read/Write/ReadWrite) is triggered by the application.
  • The resurrection time is elapsed (21 Seconds, if the Default Session settings / Interceptors are used)

A setting of TwinCAT.Ads.SessionSettings.FastWriteThrough is switching off this behaviour.

Reference

TwinCAT Namespace