Closed ideasoft-bz closed 3 years ago
Sorry, read it wrong. Did you add a route on your CX9020 for your Ads client on the raspi? I think pyads does that for you. AdsLib doesn't so you have to prepare an ADS route in your CX9020 before you try to access it from the raspi.2020-12-06T18:23:53+0100 Warning: InvokeId of response: 0 timed out Error: 1861
is an indicator that you receive data from another session. Do you run some other ADS client in parallel?
Normally I would suspect TwinCAT, but I don't believe you run TwinCAT XAE on your Raspberry Pi
Yes, I have route to rasPi. From raspi I am able to ping CX9020 IP address, but I am not able to ping its hostname. Is it possible that this is problem?
static const AmsNetId remoteNetId { 5, 84, 174, 32, 1, 1 }; doesn't match your pyAds config plc = pyads.Connection('5.84.173.32.1.1', 801, "192.168.1.30")
Yes, this is something I checked so many times and I newer really saw any difference.
Thank you very much
Hello, I am trying to communicate from Raspberry Pi to CX9020 running TC2. I get the timeout 1861 error:
./testconn.bin 2020-12-06T18:23:48+0100 Info: Connected to 192.168.1.30 2020-12-06T18:23:53+0100 Error: select() timeout 2020-12-06T18:23:53+0100 Warning: InvokeId of response: 0 timed out Error: 1861 AdsException message: Ads operation failed with error code 1861. 2020-12-06T18:23:53+0100 Info: connection closed by remote
I carefully read issue #14 adn my code is according to suggestion there:
include "AdsLib.h"
include "AdsVariable.h"
include
int main() { static const AmsNetId remoteNetId { 5, 84, 174, 32, 1, 1 }; static const char remoteIpV4[] = "192.168.1.30"; AdsSetLocalAddress({192, 168, 1, 3, 1, 1}); if (AdsAddRoute(remoteNetId, remoteIpV4)) { std::cout << "Adding ADS route failed\n"; } try { AdsDevice route {remoteIpV4, remoteNetId, 801}; //const auto state = route.GetState(); const auto info = route.GetDeviceInfo(); } catch (const AdsException& ex) { std::cout << "Error: " << ex.errorCode << "\n"; std::cout << "AdsException message: " << ex.what() << "\n"; } catch (const std::runtime_error& ex) { std::cout << ex.what() << '\n'; } }
From the same environment, python program using pyads works:
Python 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.
Any suggestion please?