Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Are you there Serial?

by bitman (Scribe)
on Aug 03, 2006 at 11:55 UTC ( [id://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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-20 02:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found