Open ghost opened 3 years ago
Hi Ole
sorry for the delay. I will try to workout an example. I know its working because our 61131 Library IP_COM (available in the PLCnext Store for free and in the bundle IT_Library), is based on the available C# functions and implements non blocking UDP and TCP communication. For your information, with the runtime profile 3.3 (implemented in FW 2021.0 LTS) the whole namespace Threading regarding to .NET Standard 1.0 is implemented. This does not include convenience features like Tasks and async/await. Probably you can also find an working example online based on .NET Standard 1.0.
Hi Marcel
Thank you for your answer.
I have created a c# library that can communicate between a master plc and several slave plc, using the UdpClient class and eCLR 3.2 profile.
I can see that eCLR 3.3 profile is installed on my computer in the folder C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\Profile\eCLR3.3.
But the files are dated January 2020, and the 3.3 version is not available as a target framework in VS 2019. I am using the 16.8.4 version.
The library I have created is using one Thread that runs the Receive method.
I am mainly a c# developer, so I want the c# code support's newest version of the eCLR.
I am using the newest version of PLCNext Eng and the latest version of the PLC firmware. For VS support, the Phonix Contact website points to the 2020 version of eCLR.
How can I install the newest version to get the eCLR 3.3 targets in code and have the latest version of the DLL files?
I looked a little bit at the site https://github.com/PLCnext/PLCnext_CLI_VS. Can I build and install the newest version myself?
Kindly regards
Ole Haagensen
From: Marcel Luhmann notifications@github.com Sent: Wednesday, 20 January 2021 14.59 To: PLCnext/CSharpExamples CSharpExamples@noreply.github.com Cc: Ole Inselmann Haagensen ole@bomitech.dk; Author author@noreply.github.com Subject: Re: [PLCnext/CSharpExamples] UDP/TCP communication example (#8)
Hi Ole
sorry for the delay. I will try to workout an example. I know its working because our 61131 Library IP_COM (available in the PLCnext Store for free and in the bundle IT_Library), is based on the available C# functions and implements non blocking UDP and TCP communication. For your information, with the runtime profile 3.3 (implemented in FW 2021.0 LTS) the whole namespace Threading regarding to .NET Standard 1.0 is implemented. This does not include convenience features like Tasks and async/await. Probably you can also find an working example online based on .NET Standard 1.0.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/PLCnext/CSharpExamples/issues/8#issuecomment-763623170, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGJOUFEWRITGP7PDYJNZJC3S23OUDANCNFSM4V524SCA.
Unfortunately the GitHub project currently only supports C++ development for PLCnext. We are currently working on the release of the 2021.0 LTS Visual Studio extension for C# development. If everything works as planned, it should be available next week. With this the new profile is available as well.
There are two use cases we have to differentiate. The first one is running your listener non blocking inside the cyclic task. For this you have to implement your own UDP client/server based on the socket class. For sockets a parameter blocking can be set to false. This is the way our 61131 IP function blocks are working. This way the socket buffer is checked every cycle. If lots of data should be send or received this could lead to a watchdog. The second option is to run the UDP connection inside a Thread. For this you can simply run the UDP communication in a Thread. An example how to use threads is given here: https://github.com/PLCnext/CSharpExamples/tree/master/PLCnext_CSharpExamples/12_Threads On top of that you could combine the self build non blocking socket connection and threads. This is the safest and probably most reliable way to avoid watchdogs.
I have got some test code snippets from our internal development. I have to review them and try to build an example out of it. But this will take me at least some weeks.
hey there, any updates on this? This is exactly what we're after! Thanks, Ash.
Hi all
I have started working on a c# communication layer for plc to plc communication.
In this context, I have found out that only the Thread class is available and not Task and await/async. By nature, the Receive method is blocking, which means that the code needs to use Threads.
It could be nice to have an example with Threads and UDP or TCP communication, especially a Listener example. I have set Thread priority to Lowest mentioned in the community.
Kindly regards
Ole Haagensen, Denmark