Beckhoff / ADS

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

Port 0x2710 is out of range #89

Closed ghost closed 4 years ago

ghost commented 5 years ago

If I run the following code:

#include "AdsLib.h"
#include "AdsDef.h"

#include <unistd.h>

int main() {
    long error_code;

    AmsNetId ams_address_net_id = {192, 168, 1, 127, 1, 1};

    error_code = AdsAddRoute(ams_address_net_id, "192.168.1.127");
    if (error_code) {
        printf("Error: AdsAddRoute: %li\n", error_code);
        throw std::exception();
    }

    while (1) {
        sleep(1);
    }

    return 0;
}

I get:

2019-05-02T18:50:44-0700 Info: Connected to 192.168.1.127 2019-05-02T18:50:45-0700 Warning: Port 0x2710 is out of range 2019-05-02T18:50:45-0700 Warning: No response pending 2019-05-02T18:50:49-0700 Warning: Port 0x2710 is out of range 2019-05-02T18:50:49-0700 Warning: No response pending

The last two warnings continuously repeat.

pbruenn commented 5 years ago

My bet is there is something on 192.168.1.127 sending out packets on the AMS TCP connection. In best case a TwinCAT trying to reach AMS port 0x2710.

ghost commented 5 years ago

I guess maybe I am a little confused. Shouldn't the TwinCAT PLC that I am reading the ADS symbols of be running on the computer at this IP address? Is this the TwinCAT you are referring to?


From: Patrick Brünn notifications@github.com Sent: Thursday, May 2, 2019 10:50 PM To: Beckhoff/ADS Cc: Thomas, Patrick; Author Subject: Re: [Beckhoff/ADS] Port 0x2710 is out of range (#89)

My bet is there is something on 192.168.1.127 sending out packets on the AMS TCP connection. In best case a TwinCAT trying to reach AMS port 0x2710.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Beckhoff/ADS/issues/89#issuecomment-488950055, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADHMBUL374FBBG4XHRJXNU3PTPHDDANCNFSM4HKPJ3DA.

pbruenn commented 5 years ago

Well, Your sample code is empty. All it does is opening a TCP connection to the host running your TwinCAT PLC. Did you tried the example?

ghost commented 5 years ago

This was a minimal working example that gives the same warnings as code I wrote to read the values from the PLC.


From: Patrick Brünn notifications@github.com Sent: Friday, May 3, 2019 11:31 PM To: Beckhoff/ADS Cc: Thomas, Patrick; Author Subject: Re: [Beckhoff/ADS] Port 0x2710 is out of range (#89)

Well, Your sample code is empty. All it does is opening a TCP connection to the host running your TwinCAT PLC. Did you tried the example?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Beckhoff/ADS/issues/89#issuecomment-489299572, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADHMBUJ2B75E6ICA7OY2MRDPTUUTJANCNFSM4HKPJ3DA.

pbruenn commented 5 years ago

Now you know the PLC or some other ADS device is sending packets over your TCP connection. If you don’t know what service this might be, I would take a wireshark capture and look into these packets.

ghost commented 5 years ago

I'll take a look. Thank you.


From: Patrick Brünn notifications@github.com Sent: Saturday, May 4, 2019 3:41 AM To: Beckhoff/ADS Cc: Thomas, Patrick; Author Subject: Re: [Beckhoff/ADS] Port 0x2710 is out of range (#89)

Now you know the PLC or some other ADS device is sending packets over your TCP connection. If you don’t know what service this might be, I would take a wireshark capture and look into these packets.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Beckhoff/ADS/issues/89#issuecomment-489315740, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADHMBUNCB67RIU7R6WKQXQTPTVR6PANCNFSM4HKPJ3DA.

ghost commented 5 years ago

Found it. It was the TwinCAT3 Scope. Thank you for your help.


From: Thomas, Patrick Sent: Saturday, May 4, 2019 6:13 PM To: Beckhoff/ADS; Beckhoff/ADS Cc: Author Subject: Re: [Beckhoff/ADS] Port 0x2710 is out of range (#89)

I'll take a look. Thank you.


From: Patrick Brünn notifications@github.com Sent: Saturday, May 4, 2019 3:41 AM To: Beckhoff/ADS Cc: Thomas, Patrick; Author Subject: Re: [Beckhoff/ADS] Port 0x2710 is out of range (#89)

Now you know the PLC or some other ADS device is sending packets over your TCP connection. If you don’t know what service this might be, I would take a wireshark capture and look into these packets.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Beckhoff/ADS/issues/89#issuecomment-489315740, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADHMBUNCB67RIU7R6WKQXQTPTVR6PANCNFSM4HKPJ3DA.

simonschmeisser commented 10 months ago

This message is somewhat confusing, could it be muted? Do you need a wireshark capture? The message stops arriving every 10s once closing the Visual Studio.

pbruenn commented 10 months ago

Well, you can hide warnings by setting Logger::logLevel=4 https://github.com/Beckhoff/ADS/blob/master/AdsLib/Log.h#L26, but you already know why it is happening. Simply because something else on the same machine is sending requests from an "Amsport 0x2710". This thing is most certainly TwinCAT running on the same machine as your ads application. The thing is if you want them to coexists, then stop using the standalone mode and switch to twincat mode e.g. use the existing TwinCAT router on that system. This is done by setting tcadsdll_include and tcadsdll_lib https://github.com/Beckhoff/ADS/blob/master/meson_options.txt

simonschmeisser commented 10 months ago

Actually we don't have anything besides this library running on our Linux computer. TwinCat IDE is running on the Windows computer. This is not a high priority issue for us, just would be nice to have in order not to confuse users.

I would expect that some warnings would be important enough so I don't want to miss them and disabling them is a bad idea?

pbruenn commented 10 months ago

hmm, this is something I don't understand. You have a Windows TwinCAT Client, a Linux Client with your AdsLib application and a TwinCAT PLC?

And then you see these warnings on the linux client? Actually in that case your wireshark capture or a diagram of your setup (with ip addresses) might be helpful. Send me an email if you want. This sounds like a pretty specific issue.