Connect

Creates a new ADS client communication object for a single ADS device by a given AdsNet Id and port number.

HRESULT Connect(
  AmsNetId*    pAmsNetId,
  long         nPort,
  ITcAdsSync** pipTcAdsSync
);

Parameter

pAmsNetId

[in] Variable presents the Ams Net Id by the structure type AmsNetId. If the Net Id is set to 0.0.0.0.0.0, the connection to the local TwinCAT system is established. If no TwinCAT system is installed on the client PC, the connection uses TCP/IP. The limitation of TCP/IP connection is that the client can only connect to the main remote device with AMS Net Id = TCP/IP address + 1.1.

nPort

[in] ADS port number of the ADS device to be communicated with.

ITcAdsSync

[out, retval] Returns a pointer to a ITcAdsSync

pointer that contains the object used for ADS communication. 

Return values

S_OK

The connection function was called successfully.

ADSERRORCODES

An error occurs.

Comments

To connect to a remote TwinCAT system, the remote device must be added to the list of remote computers in the TwinCAT system. If a TwinCAT system is installed on the client PC and the remote PC, the client PC must be entered in the list of remote computers in the remote PC and vice versa. If no TwinCAT system is installed on the client PC, the client PC only has to be entered in the list of remote computers in the remote PC. In this case the AMS Net Id consists only of the TCP/IP address + 1.1. .

Connect 1: