Beckhoff / AdsToJava

This library is intended for use in ADS client applications written in the Java programming language.
MIT License
8 stars 2 forks source link

Remove system_error out for failed socket connection #8

Closed nicovitt closed 4 months ago

nicovitt commented 6 months ago

Hi,

The socket connection in ADS submodule throws a system error message when a socket cannot be created (Sockets.cpp line 140).

Would it be possible to remove this so that no system error is thrown?

Using AdsCallDllFunction in a java program results in a complete crash which is not manageable in a java program using AdsToJava. For context: We have a custom connector calling the implementation for ADS and handling reconnection and many more functionalities. The connector runs on linux with systemd service manager which terminates with result core-dump when hitting throw std::system_error(WSAGetLastError(), std::system_category());. Our connector runs connections to many TwinCAT PLCs and crashes because of the one that is not connected so every other connection is also interrupted when the service restarts when catching the system_error.

I don't know whether this can also be achieved within the system configuration file but for me it seems more manageable to remove the specified line.

Thanks for your feedback.

nicovitt commented 6 months ago

So, I cloned the ADS repo and built the libads.so myself with every throw removed from Sockets.cpp. This works but I haven't taken a deeper look into what side-effects this might have caused. For now it seems to be working for AdsToJava.

vossjannik commented 4 months ago

I assume now that it is fixed by my pull request.

nicovitt commented 4 months ago

I guess so. Looks good. Unfortunately, the build with github workflow failed.

vossjannik commented 2 months ago

I guess so. Looks good. Unfortunately, the build with github workflow failed.

@nicovitt The build still worked locally. I fixed the GitHub build and updated all dependencies. Here is the new version: https://github.com/Beckhoff/AdsToJava/releases/tag/3.1.0-27