Description
This example shows how to write to and or read from an XCON (TCP, UDP, etc.) connection. The connection can be handled with LUA function. The write value can be written from any selected item, and the read value also be written to an output item.
The read function handles the incoming values and converts them into a hex dump string.
This tutorial has two functions:
- Send_TcpHex(): used to send HEX values of an Item in this example : ('NETx\\VAR\\String\\Item001') to the Server which has IP address : 127.0.0.1 and Port : 23. More info about xcon.SendHex
- MyTCP_OnReceiveEvent(data, size, sourceip, sourceport): This callback function is invoked when an XCON connection has been established. Implement a callback function for each connection to monitor and name it accordingly, e.g. for connection named MyTCP implement the callback function MyTCP_OnReceiveEvent().
...