09-25-2017 03:24 PM
I'm using LV data socket to communicate with a Rockwell PLC via RS Linx. The problem I have is that I can only connect to the PLC successfully second time around. The first time I run my code after logging onto windows the data socket returns error 56. If I stop, exit and restart the program then the PLC connection is made almost instantaneously. I'm wondering if the cause might be to do with RS Linx not being configured correctly, but it's puzzling why it should only work after one unsuccessful attempt. I am starting RS Linx immediately at logon.
09-26-2017 03:14 AM
I don't know RS Linx, but may be some intermediate software to be loaded and initialized when you make the first read. This intermediate software may not be ready before the read timeout expires.
When connecting to an OPC server, I always put at least one dummy read in order to "wake up" all the stuff, overlooking any error in this first stage.
09-26-2017 03:18 AM
Thanks. I guess it's a possibility. The only thing is it doesn't seem to matter how long I wait after logon - the first attempt to access the PLC seems to fail.
09-26-2017 03:30 AM
In my case, the right OPC server is started only at the time I indirectly call it by reading an OPC item. This "magic" is done thru the MS OLE mechanism.