IAdsHandleAccess.TryRead Method

Reads data synchronously from an ADS device and writes it to the given stream.

Namespace:  TwinCAT.Ads
Assembly:  TwinCAT.Ads (in TwinCAT.Ads.dll) Version: 4.3.0.0

Syntax

C#

AdsErrorCode TryRead(
    int variableHandle,
    AdsStream dataStream,
    int offset,
    int length,
    out int readBytes
)

VB

Function TryRead ( 
    variableHandle As Integer,
    dataStream As AdsStream,
    offset As Integer,
    length As Integer,
    <OutAttribute> ByRef readBytes As Integer
) As AdsErrorCode

Parameters

variableHandle

Type: System.Int32
Handle of the ADS variable

dataStream

Type: TwinCAT.Ads.AdsStream
Stream that receives the data.

offset

Type: System.Int32
Offset of the data in dataStream.

length

Type: System.Int32
Length of the data in dataStream.

readBytes

Type: System.Int32.
Number of successfully returned data bytes.

Return Value

Type: AdsErrorCode
AdsErrorCode

Exceptions

Exception

Condition

ArgumentException

Reference

IAdsHandleAccess Interface

TwinCAT.Ads Namespace