Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Are you there Serial?

by bitman (Scribe)
on Aug 03, 2006 at 11:55 UTC ( #565428=perlquestion: print w/replies, xml ) Need Help??
bitman has asked for the wisdom of the Perl Monks concerning the following question:

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?

Replies are listed 'Best First'.
Re: Are you there Serial?
by Hue-Bond (Priest) on Aug 03, 2006 at 13:10 UTC
    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?
by starbolin (Hermit) on Aug 03, 2006 at 17:22 UTC

    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.

    bitman 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}

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://565428]
Approved by Corion
and the radiator hisses contentedly...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2018-05-20 12:39 GMT
Find Nodes?
    Voting Booth?