Comments (4)
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.
from csharpexamples.
from csharpexamples.
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.
from csharpexamples.
hey there, any updates on this? This is exactly what we're after! Thanks, Ash.
from csharpexamples.
Related Issues (16)
- Example request: How to use threads
- Non-descriptive SocketException HOT 1
- Recommended way to communicate with Azure? Http? MQTT? HOT 2
- Index Out of Range
- Global variables example
- PcosDomain methods
- Add support of Visual Studio 2022 HOT 1
- Program template could be clearer
- WriteFile example seems to be missing a class reference
- Broken link HOT 1
- Enums HOT 3
- Broken link HOT 1
- Array Of Struct Example HOT 1
- The type or namespace name 'OPCAttribute' could not be found HOT 1
- Broken link
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csharpexamples.