Git Product home page Git Product logo

Comments (5)

pbruenn avatar pbruenn commented on July 21, 2024

ADSIGRP_SUMUP_DELDEVNOTE is not implemented in AdsLib, and I guess it isn't in TwinCAT, too.

To reduce wait time you could set the port timeout to 0 and ignore the AdsSyncDelDeviceNotificationReqEx error code (would be ADSERR_CLIENT_SYNCTIMEOUT)

AdsSyncSetTimeoutEx(local_port, 0);
for (auto h: handles) {
    AdsSyncDelDeviceNotificationReqEx(local_port, &target, h);
}

Or if you just want to clean up the easy way, make sure you allocated all notifications from the same local_port, and just close the port. The cleanup code will take care and delete the notifications for you.

AdsSyncSetTimeoutEx(local_port_notifications, 0);
AdsPortCloseEx(local_port_notifications);

But keep in mind there is a TCP connection in the background (I expect you are not working on localhost). So make sure the AdsDelRoute() is not called to early, or the EtherCAT Master might not get all AdsDelDevNotificationRequests.

from ads.

gechelberger avatar gechelberger commented on July 21, 2024

Thanks for the response.

It looks to me like calling AdsDelRoute shouldn't be a worry as long as it's done on the same thread as AdsPortCloseEx.

Calling AdsPortCloseEx will definitely clean up all of the handles properly, but it looks like it still does that synchronously by walking the notifications opened on a port, telling it's dispatcher to erase them, which individually calls DeleteNotification to send the relevent DELNOTE AmsRequest on the AmsConnection for that dispatcher.

Do you know where I could submit a bug report/feature request for the SUMUP_DELDEVNOTE support in the twincat server itself?

from ads.

pbruenn avatar pbruenn commented on July 21, 2024

You are right about the cleanup sequence. Setting the timeout to 0 would just simulate "asynchronous" closing, by not waiting for the response. In that case you can be sure that the operating systems sockets write() was called, but you can't be sure the data was already send to the wire. So if you call AdsPortCloseEx() to early, it would shutdown the socket before the whole buffer was send.
I am not sure about your use case but maybe std::async(AdsPortCloseEx, local_port) fits better, if you just don't want to wait inside your main thread.

In general your local support office would handle TwinCAT bug reports and feature requests. The product manager for TwinCAT ADS is Sven Oberschmidt, he would have answered your question here, but currently he is on vacation.

from ads.

gechelberger avatar gechelberger commented on July 21, 2024

Thanks. I missed the implication yesterday and this seems like it definitely mitigates my problem substantially, though you are correct that it does mean that I need to be careful about cleaning up routes.

Might I also suggest then that in AmsPort::Open or AmsPort::Close you reset the port's timeout to Default.

As to support, I've had really great experiences in the past working with Beckhoff's field technicians, but emailing support.usa@beckhoff has rarely gotten me results. I think it was 2 years ago that I got in touch about bugs in this sample that are still there today:

http://infosys.beckhoff.com/content/1033/tcsample_vc/html/tcadsdll_api_cpp_sample18.htm?id=50301061431851636012

Specifically, the release handles packet should be using index group 0xf006 rather than 0xf020, and the return code checks that follow are referencing the return code buffer from the original handle acquisition response rather than the release response (pBuffRes rather than pBuffRelRes).

from ads.

pbruenn avatar pbruenn commented on July 21, 2024

I re-triggered your bug report in the TC2 example, too.

from ads.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.