Return values

The interface functions have HRESULT as return values. The returned values are derived from the ADS Return Codes. Their meaning for TF6311:

Value
(Enum)

Value
(Numeric)

Description

ADS_E_INVALIDPARM

0x9811070B

Socket not allocated/known, transferred pointer NULL

ADS_E_NOMOREHDLS

0x98110716

No free sockets available.
Default: 32
see TCP/UDP RT TcCom Parameter

ADS_E_INCOMPATIBLE

0x9811070E

Socket in wrong state.
E.g. Connect() attempt, if a socket was previous used with Listen(); Close() without previous connection; Send() without connection; Socket Listen(), if a Listen() call was already issued.

ADS_E_INVALIDSTATE

0x98110712

TCP/UDP RT object is not in OP mode

ADS_E_INVALIDDATA

0x98110706

Problem with parameter.
E.g. pData==NULL for SendData

ADS_E_EXISTS

0x9811070F

Port already used otherwise

ADS_E_PENDING

0x9811071E

Not all data were sent (SendData)

S_OK

0x0

Call successful.
IsConnected(): Connection exists

S_FAIL

0x1

Call not successful, general error
IsConnected(): Connection does not exist

The values from the range 0x9811 are defined in the enumeration "E_HRESULTAdsErr" (PLC) and corresponding ADS_E_* (C++) "defines".