Store PLCnext CommunityPLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

  1. pynl02
  2. PLCnext Technology & PLCnext Controls
  3. Friday, 08 February 2019

Hello,

I'm trying to implement function blocks with C# that implement a TCP server. I could implement the code with the TcpListener and have no Problem

implementing the FB in PCWorxEngineer. But when I try to connect the PLC always fails.

Are there any example code for implementing TCP sockets or any other help?

Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hello,

I'm guessing that, in your C# code, the TCP function "blocks" the Execute method and so the Task Watchdog timer is triggered.

You can check this by looking at the contents of the ~/logs/Output.log file on the PLC after it stops. There should be a message describing what caused the PLC to stop.

There is currently no up-to-date example I can share, but there has now been a feature request raised on the CSharpExamples GitHub repository on the issue of blocking calls. Please follow this issue and/or perhaps raise your own Feature Request (for a TCP Server example) on this GitHub repository.

Hope this helps.

- Martin

Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support

pynl02 Accepted Answer Pending Moderation
0
Votes
Undo

Your Tip with the blocking issue was helpful. By redesigning the function block I fixt my Problem. Now My TCP server is working

  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.