Would this lock the system up?
Hi all,
Would this lock the system up, and therefore unadvisable to do, or would it work OK?
DATA_EVENT[dvDevice]
{
ONLINE: //do something
OFFLINE: //do something
ERROR:
{
IF(data.number==17) IP_CLIENT_OPEN(dvDevice.port,sIPaddress,nPort,1)
}
}
Maybe add in a WAIT before reconnecting?
Cheers,
Gerald.
Best Answer
-
HARMAN_icraigie Posts: 660
Improperly handling an IP connection error can easily initiate an infinite run-time loop.
I prefer to manage any IP connection from a timeline (>=30-second interval) then manipulate the timeline as needed. The connection state is evaluated at the timeline event and ip_client_open() called if not connected.
Setting the timeline to the end with offline or to the beginning with an error limits the possibility of inadvertently ending up in that infinite loop and ensures the connection is robustly maintained.0
Answers
Cheers Ian.
It was a radical idea to get over a non-connection problem.
Originally, the device was being connected to in the DEFINE_START section (as IP_CLIENT_OPEN) and inside a module specifically to do the same thing, which I thought was an overkill - so I commented out the IP_CLIENT_OPEN lines in favour of the modules. But I think I'm going to ditch the modules instead - I uncommented those lines out and it works OK now.