Now then, does anyone know how I can detect if the device is connected? Can I use a timeout? If so, can I get an example?
how I can detect if the device is connected?
AFAICT, there's no way but I'd like to be wrong. In a protocol I had to implement, there were two messages designed to detect this, the typical ping and pong. On startup, a ping was sent and the program assumed there was no connection if no pong was received. Both peers did the same. So, in any case, the second machine that went online caused the connection to be active.
--
David Serrano
In a serial protocol the presence of an external device can pe indicated by asserting DSR. FreeBSD, for example, will block on open if DSR is not asserted and clocal is set. Without more infomation ( system, driver, sample code ) it would difficult to provide anything specific to your application.
[id://104707] writes:
"If so, can I get an example?"
Show me yours and I'll show you mine.
perlmonks.org content © perlmonks.org and bitman, Hue-Bond, starbolin
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03