.NET communication

This sample demonstrates how a suitable .NET communication partner for the PLC peer-to-peer device A can be realized. Only use this sample in conjunction with the PLC project PeerToPeerA.

.NET communication 1:

The .NET Sample Client can be used to send single UPD data packages to a UPD Server, in this case the PLC project PeerToPeerA.

Download

Download the test client.

Unpack the ZIP file; the .exe file runs on a Windows system.

How it works

The sample uses the .Net libraries System.Net and System.Net.Sockets to implement a UDP client (class UdpClient). While listening for incoming UDP packets in a background thread, a string can be sent to a remote device by specifying its IP address and port number and clicking the Send button.

For a better understanding of this article, imagine the following setup:

Description

The client itself uses port 11000 for sending. At the same time it opens this port and displays received messages in the upper part of the interface as a log:

.NET communication 2:

Together with the PLC / C++ samples, this results in an echo sample:
A UDP message is sent from the client port 11000 to the server port 10000, which sends the same data back to the sender.

The client can be configured via the interface:

The TF6311 "TCP/UDP Realtime" does not allow local communication. However, for testing purposes a different network interface can be selected via "Source", so that the UDP packet leaves the computer through one network card and arrives on the other network card ("loop cable").