# TCP driver, missing messages and loss of connection

**URL:** <https://forum.inductiveautomation.com/t/tcp-driver-missing-messages-and-loss-of-connection/17333>\
**Category:** Ignition\
**Tags:** ignition78\
**Created:** [March 12, 2018, 10:44pm UTC](https://forum.inductiveautomation.com/t/tcp-driver-missing-messages-and-loss-of-connection/17333 "2018-03-12T22:44:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 12, 2018, 10:44pm UTC](https://forum.inductiveautomation.com/t/tcp-driver-missing-messages-and-loss-of-connection/17333/1 "2018-03-12T22:44:20Z")

</div>

Update: I seem to be mistaken about the UDP connection. It's TCP. Post edited.

* * *

My Ignition reading of a checkweigher is missing transmissions.  
Skip to the end for the actual questions. Come back to here for the details.

* * *

**The details**

I have several checkweighers serving on port 9000 a weigh reading every 3 s or so, when running. The message is in the form:

> "?Date=2011-05-11,TIME=9:47:31,MachineID=1234567,Product=Yum Yum Chocolate CM,SKU=YYC001,Weight=216.35,TO=228.37,Target=216.37,TU=204.37,Length=183,Speed=35.0,TradeCount=997,Total=1000,BatchNum=RUN3 30 MIN?"

I have a TCP driver setup with

- IP address:
- port 9000
- Inactivity timeout = 0
- Message delimiter type: PacketBased
- Message delimiter: [blank]
- Field count: 0
- Field delimiter: [blank]

Tag configuration:

- Data type: String
- Enabled: Yes
- Access Rights: Read only
- OPC Item Path: ns=1;s=[{OpcDevice}]9000/Message
- Source data type: Automatic
- Scan class: Default

I am able to parse the messages and assign the values to the tags in my UDT.

Maybe relevant:

- OS: Windows 10.
- Ignition 7.8.
- Checkweigher is behind a multi-NAT router connected to the same LAN as the Ignition server.

* * *

**Problem**

![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/2/2abd2d90bf0215cbf49be562797d5ed116a20f1c.png)

1. The Tag Browser alternates between connected and not connected.
2. I'm not catching all the messages. I pop them into a database with the transaction manager and I can see that the 'Total' field increments one at a time sometimes and then skips one, two or three records. I can see this in the Ignition Web OPC Client too.
3. I'm monitoring the Total value in my \_UdpDataString valueChanged event and it intermittently drops from the current count (e.g., 2637) to 1 and then resumes the count. (Ignore the fact that it's not UDP.)

valueChanged event code:

> # Check that the datastring starts and ends with '?'. If not exit.
> 
> if not currentValue.quality.isGood():  
> return  
> cv = currentValue.value  
> if (cv[0:1] + cv[-3:-2]) != '??':  
> return  
> cv = cv[1:-3]
> 
> # Create a dictionary by splitting on ',' and then on '='.
> 
> d = dict(x.split('=') for x in cv.split(','))
> 
> system.tag.write("[.]DebugString", str(d['Total']))  
> system.tag.write("[.]BatchNum", d['BatchNum'])  
> system.tag.write("[.]Length", d['Length'])   
> system.tag.write("[.]MachineID", d['MachineID'])   
> system.tag.write("[.]Product", d['Product'])   
> system.tag.write("[.]SKU", d['SKU'])   
> system.tag.write("[.]Speed", d['Speed'])   
> system.tag.write("[.]Target", d['Target'])   
> system.tag.write("[.]TradeCount", d['TradeCount'])   
> system.tag.write("[.]TU", d['TU'])   
> system.tag.write("[.]Weight", d['Weight'])
> 
> # Write the total last as this will trigger the Transaction Group and we want the others ready first.
> 
> system.tag.write("[.]Total", d['Total'])

* * *

**Questions**

1. Can anyone suggest a way to prevent the 'not connected' status?
2. Is my TCP setup correct for my application?
3. Am I using the correct scan class or should I create a dedicated one?
4. What would cause my count to drop to 1 intermittently? (I have the transaction group paused so it shouldn't be that.)

Many thanks.

---

<div class="post-metadata">

**Author:** ![zacslade](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacslade/32/3587_2.png) [@zacslade](https://forum.inductiveautomation.com/u/zacslade)\
**Post date:** [March 13, 2018, 4:10pm UTC](https://forum.inductiveautomation.com/t/tcp-driver-missing-messages-and-loss-of-connection/17333/2 "2018-03-13T16:10:16Z")

</div>

Hi there,

Not an expert on Ignition’s TCP/UDP driver, but I’m interested in learning the solution to this issue. So I’m here to bump and subscribe.

Just so I’m not totally useless, though, here are some questions/comments that come to mind after reading your post:

- Are you sure about the default behavior of the driver with Inactivity Timeout set to 0? I mean, if it’s set to zero, does that mean that it will never disconnect and reconnect, or is there some other situation that could cause it to do that?

- I don’t expect that the scan class makes a difference, since you’ve disabled the disconnect timeout. I expect that it would just give you the most recent value. But is it possible that it’s trying to poll the checkweighers on scan and expecting a response in a short time? Also, you might want to check on the timeout for stale quality to make sure that it won’t go stale before you’ve had a chance to get a new value from the UDP driver.

Good luck!
