Beckhoff / ADS

Beckhoff protocol to communicate with TwinCAT devices.
MIT License
502 stars 194 forks source link

twincat server on localhost #93

Closed ao-droid closed 3 years ago

ao-droid commented 5 years ago

I would like to run ads clinet on the same machine as the server. Does this lib support it?

pbruenn commented 5 years ago

No, use one of the libraries provided with TwinCAT: https://infosys.beckhoff.com/english.php?content=../content/1033/tcadscommon/html/tcadscommon_intro.htm&id=

ao-droid commented 5 years ago

I preasume I have to change the example... Since with Beckhoff libs I only need the port number if you connect locally?...in your version I need to specify a static route in TC

pbruenn commented 5 years ago

Yes, with the TwinCAT dll you don’t need to setup a route, especially on localhost.

ao-droid commented 5 years ago

OK thanks for replay.

pogojotz commented 4 years ago

I had it running once on the localhost, but the route "back" has to be configured manually in TwinCat and it sometimes failed to work (don't remember the details).

At some point I gave up due to the lack of reliability and used the blob from Beckhoff.

ao-droid commented 4 years ago

Thanks for your info...I also used the Beckhoff libs... However recently somebody told me that the git libs also work locally, but I forgot to post it. It turns out you need to guess the client AmsNetId. Only last value needs to be changed... but it only works with specific values. I was told it can also be done without the static route in twincat3 which did't work in my case. Don't know if it's reliable because I didn't have time for a through test...maybe some other time.

ccvca commented 10 months ago

I've had success using the external IP and using AdsSetLocalAddress to set a different ID and add this route to ADS E.g.:

AdsSetLocalAddress({192,168,1,23,1,2});
AdsDevice route {"myDNSForADS", {192,168,1,23,1,1}, AMSPORT_R0_PLC_TC3};