I've written Home automation system driver in Perl that connects to LMCE as external DCE parent device. But I have constant problems that quite rarely but frequent enough to bug me looses connection to DCERouter.
DCERouter's behaviour is not really consistent in such situations. Here are my findings:
1. Possible "deadlock" when device is disconnected : DCERouter seems to be quite picky if device doesn't respond right away and disconnects it imediately without any message on any of TCP ports... In such case it's hard to determine what happened on device side. The only thing you have is PING-PONG handshake check, but quite often I get into situation, where DCERouter responds with PONG to my PING messages, but device is still declared as not registered on web-admin. That means that my device thinks it's connected, but DCERouter won't send any messages to it and also disregard all messages from device... Not a nice thing to happen.
1.a It would probably be fine if DCERouter would send a message (possibly with a reason) to a device and then kill TCP port. And also make clear entry in its log...
2. Deadlock when device gets disconnected from DCERouter:
A file "/usr/pluto/locks/pluto_spawned_local_devices.txt" plays significant role. When a device is started then obviously its ID is written to this file. Now, for instance if device gets disconnected as in above scenario, it's entry stays in this file. And if DCERouter is reloaded, then this device won't get started. It also won't receive reload command cause it's disconnected... What helps is full reboot of machine, or manual deletion of device ID from above file and DCERouter's reload...
2.a DCERouter or someone else should take care of entries in "/usr/pluto/locks/pluto_spawned_local_devices.txt" if devices are disconnected cause of any emergent reason...
3. Sometimes I cannot register as ASCII client and I receive binary messages :
On every few connections, I don't register properly for ASCII DCE messages and in this case my device driver gets screwed. I've followed instructions, but I must be missing something in registration procedure that causes DCERouter to send binary messages instead of ASCII. Anyone with more insight in registration procedure ?
- PING-PONG handshake is currently the only way for a device to find out whether it's registered or not - although one can receive proper PONG responses but still being not registered.
4. Can I use PING-PONG on any TCP port that is connected to LMCE ?
5. Any other way for a device to determine whether it's registered or not ?
I'd kindly ask for any more info about DCE registration procedure, advices or opinions if those propositions are sound,
thanks in advance,