Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Are you there Serial?

by bitman (Beadle)
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?

Comment on Are you there Serial?
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://565428]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2014-12-26 04:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (165 votes), past polls