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  | Value  | Description  | 
ADS_E_INVALIDPARM  | 0x9811070B  | Socket not allocated/known, transferred pointer NULL  | 
ADS_E_NOMOREHDLS  | 0x98110716  | No free sockets available.   | 
ADS_E_INCOMPATIBLE  | 0x9811070E  | Socket in wrong state.  | 
ADS_E_INVALIDSTATE  | 0x98110712  | TCP/UDP RT object is not in OP mode  | 
ADS_E_INVALIDDATA  | 0x98110706  | Problem with parameter.  | 
ADS_E_EXISTS  | 0x9811070F  | Port already used otherwise  | 
ADS_E_PENDING  | 0x9811071E  | Not all data were sent (SendData)  | 
S_OK  | 0x0  | Call successful.  | 
S_FAIL  | 0x1  | Call not successful, general error  | 
The values from the range 0x9811 are defined in the enumeration "E_HRESULTAdsErr" (PLC) and corresponding ADS_E_* (C++) "defines".