Are you there Serial?
bitman
created: 2006-08-03 07:55:36
Without using Device::SerialPort (because it would be difficult to install) I have managed to talk to my serial device (/dev/ttyS1) and communicate back via a socket. The device will send a reply to a request, so if I send '@' I will get a reply, if it's connected.

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?

Re: Are you there Serial?
created: 2006-08-03 09:10:54
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

Re: Are you there Serial?
created: 2006-08-03 13:22:03

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.


s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}

perlmonks.org content © perlmonks.org and bitman, Hue-Bond, starbolin

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03