ITcClient::Connect

Creates a new Ads Client communication object for one particular Ads device by given AdsNet Id and Port Number.

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

Parameters

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 is made to the local TwinCAT system. If the client PC has no TwinCAT system installed the connection uses TCP/IP. The limitation on TCP/IP is that the client can just establish connections to the main remote device with the AMS Net Is = TCP/IP address + 1.1. .

nPort

[in] The Ads Port number of the Ads device we want to communicate with.

ITcAdsSync

[out, retval] Returns a pointer to an ITcAdsSync pointer that holds the object that is used for Ads communication.

Return Values

S_OK

The connect function was successfully called.

ADSERRORCODES

An error occurs

Remarks

To establish a connection to remote TwinCAT Systems, the remote device has to be added to the list of Remote Computer on the TwinCAT system. If on client PC and remote PC a TwinCAT system is installed, the client PC has to be added to the list of remote computer on the remote PC and vice versa. If the client PC does not have a TwinCAT system installed the client PC has just to be added to the list of remote computers on the remote PC.
If the Client PC has no TwinCAT system the AMS Net Id is just the TCP/IP address + 1.1. .

ITcClient::Connect 1: