fbarresi / Sharp7

Nuget package for Sharp7
MIT License
207 stars 73 forks source link

Integrating a managed version of S7Server in Sharp7 #39

Open Thieum opened 1 year ago

Thieum commented 1 year ago

At the moment, it's not possible to emulate an S7 server without the native dll, as shown in the unit tests.

It would be nice to replace the native version of the S7 server with a completely managed one, and integrate it in the Sharp7 library, as a way to replace the native dll completely, even in an S7 Server emulation scenario.

fbarresi commented 1 year ago

Hi!

Thank you for opening this issue. This is actually a very good idea, but (don't take it personally) I have to mark it as a 'won't do' .

The reasons

I have to admit, I alto gave a try time ago, then abandoned the project due to lack of a real use case in the business. The problem is: such a server is really good simulation engine, but you or your customer will later use a real plc, so do we really need to make it managed or can we live with the native implementation? My reply was: better less effort as possible, so I leaved the server native.

A secondary minor reason: a server might be strictly diveded from the client, in particular if you are going to deliver your client embedded somewhere. It will probably require a own repository.

Last but not least, I already created an alternative to the direct usage of the native server: Softplc. This application can run standalone or in a container and it has an api you can configure so you don't have to restart or manual configure your setup every time you want to test. It also persist after restart. For me is this solution a good alternative with some addons to the original native server: check it out!

I hope you can understand the reason why I will not follow this idea, but I will be happy to star/support/spread such a project initiated by you or somebody else.

Best regards, FB

Thieum commented 1 year ago

@fbarresi Thanks a lot for your answer! I understand your reasons, no problem! The main reason I wanted a managed server was to ease the deployment on linux - shipping the so file precompiled seems to be tricky, considering there's a dependency to glibc, at least when I compiled it.

We found it easier to ship and build the native code on those platforms, and I've been working on a vcpkg for snap7, to ease the process even more: https://github.com/microsoft/vcpkg/pull/33221

Softplc is an interesting alternative for emulation, thanks for pointing it out!