TCP device driver connection issues

I have configured the TCP driver to monitor a checkweigher which spits out a data string at 3 s intervals when running. The connection status keeps changing from Good to Not Connected.

In an attempt to debug the comms I created a DebugString tag in my UDT. I can write to this in the TCPDataString value changed event as follows:

system.tag.write("[.]DebugString", “TCP value changed! " + currentValue.value[22:30] )
if currentValue.quality.isGood():
system.tag.write(”[.]DebugString", “TCP value is good @ " + currentValue.value[22:30] )
if currentValue.value != system.tag.read(”[.]_FilteredDataString"):
else:
system.tag.write("[.]DebugString", "TCP value is NOT good @ " + currentValue.value[22:30] )

Figure 1. Watch the DebugString. Every 20 s or so it reports a random number. (The animation is 20 s long and there is one occurrence of the string ‘7’.)

Questions

  1. Where is the ‘7’ coming from? There is nothing else writing to that tag.
  2. Why is my connection dropping off?

Figure 2. TCP device configuration.

Figure 3. Console report.