plc_tag_create timeout question

122 views
Skip to first unread message

Krister Johnson

unread,
May 16, 2022, 6:34:39 PM5/16/22
to libplctag
At some point, I had an issue with using a timeout of 0 in calls to plc_tag_create - I was getting happy statuses for some tags that didn't actually exist. At that point, I started defaulting to 100ms timeouts in my calls to plc_tag_create.

I'm doing some cleanup and testing and noticed when I call plc_tag_create with a timeout > 0 for a PLC that doesn't exist (vs for one that is online, but does not have a tag matching the tagname in question), the call just hangs. I'm back to calling it with a timeout of 0 to avoid this, but could there be something I'm missing here? I haven't built the library in a while, maybe this was a bug I missed or I need to do something else to check connectivity to the PLC first?

Kyle

unread,
May 18, 2022, 11:04:19 AM5/18/22
to libplctag
100ms might not be long enough.  I have seen initial tag creation take a lot longer than that, even on a ControlLogix.

Please try with a recent version of the library.   There was some work done in the past year or so to handle some kinds of connection problems more gracefully.  If you are still seeing issues, then this may be a bug.

Note that if the PLC is not there, and you use a timeout of 0, you should just see a continuous status of PLCTAG_STATUS_PENDING.   Under the hood, the library will continue to try to connect to the PLC.  It cannot tell the difference between a PLC that is not there and one that was turned off or removed from the network for some reason.

I will try to set up a test for this later this week to make sure that the case of timeout > 0 and no PLC generates the correct status.

Best,
Kyle

Kyle

unread,
May 30, 2022, 10:14:11 AM5/30/22
to libplctag
Oops, this got away from me.

I tried testing against a PLC with an incorrect tag name.   I get an error right away when trying to open the tag.  I am using version 2.5.0.

OS: macOS 12
Compiler: Clang (version 10 or 11 I think)
libplctag version: 2.5.0
PLC: ControlLogix L81 firmware v31

Are you using a wrapper?

Best,
Kyle
Reply all
Reply to author
Forward
0 new messages