TCP/UDP

With the TCP/UDP interface, raw data can be exchanged between the PLC and the remote server. At the same time, a server can also be started to listen for data.

Info: The interface automatically synchronizes with the slowest cycle of the assigned PLC. The telegrams are buffered by the system so that no telegram is lost.

Monitor

The following colors are used in the monitor.

Color Description
White No error has occurred.
Orange The timeout was reached.
Green The connection was successful.
Red The connection could not be established or a critical timeout occurred during sending. Possibly, an error in the UDP communication is not detected.

Broadcast and Multicast

It is possible to send and receive broadcast and multicast via the TCP/UDP interface. The operating mode is selected accordingly in the gateway configuration. After that, various options such as TCP will no longer be available. In addition, the selection of the outgoing interface becomes mandatory.

To send telegrams, the IP must also be entered according to the specification next to the field. If this is not the case, unicast is sent.

Mode Description
Unicast Enables direct communication.
Limited Broadcast Allows communication only in the local network. (IP-independent)
Directed Broadcast Enables communication to the broadcast subnet. For example, 10.0.0.255 if the subnet contains 24 bits or is set to 255.255.255.0.
Multicast Enables communication via multicast. IGMP snooping is used for this purpose.

Detecting the End of a Packet

The condition for ending the transmission can be set in the line break configuration. The detected end is also sent along with it.

If the end is not detected, the interface waits for the timeout or the end of the connection and sends the result to the PLC. It is therefore recommended to check all received packets. Receiving UDP telegrams has no timeout.

HTTP Transmission

The method can be defined using the following line break:

HTTP

This is special because it allows reacting appropriately to Content-Length in the header.

After a Certain Length

To end reception after a certain length, the following string can be used in the line break configuration:

LEN === ###

Where ### corresponds to the number of characters. The notation must exactly match this including the spaces.

Warning: Using LEN === 1 receives each character individually and can lead to increased server load.

Custom Line Ending

Various line endings can be defined. Normally, \n or \r is used for this purpose. Each line defines a different detection of the line ending.

The following characters receive an escape in the configuration:

\\ \r \n \0

Communication

In outgoing communication via TCP, the connection is terminated after each request.

If no response is received from sendrecv during the request, the sending interface is blocked until the timeout is reached. An error is displayed in the monitor.

Variable Description
send Sends the data to the server.
!send Sends all data to the server and skips no telegrams.
sendrecv Like send, but waits for a response.
!sendrecv Like !send, but waits for a response.
response The response from sendrecv. When the timeout is reached, an empty string is returned.
recv Data received from the local server.
error If an error occurs during transmission, the value is true. This can occur with sendrecv only after the timeout.

Note: Please note the security of the interface. Data should never be transmitted directly over the Internet. Authentication and encryption via SSL or TLS are missing here.