AdsClient.ConnectAndWaitAsync Method

Connects to the target address and waits until the AdsClient is disconnected asynchronously.

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

Syntax

C#

public Task ConnectAndWaitAsync(
    AmsAddress address,
    CancellationToken cancel
)

Parameters

address

Type: TwinCAT.Ads.AmsAddress
The target address.

cancel

Type: System.Threading.CancellationToken
Cancellation Token.

Return Value

Type: Task
Returns a task object that represents the ConnectAndWaitAsync(AmsAddress, CancellationToken) operation as result.

Remarks

This method is used for scenarios, where the AdsClient disconnects from other code asynchronously. When this method returns, the connection is already terminated and only additional cleanup code should be processed.

Reference

AdsClient Class

TwinCAT.Ads Namespace