Xref: utzoo comp.unix.wizards:25253 comp.unix.internals:2675 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!uakari.primate.wisc.edu!sdd.hp.com!wuarchive!uunet!tellab5!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.wizards,comp.unix.internals Subject: Re: Getting status of DCE device from a DTE device Message-ID: <1991Apr29.211345.12615@chinet.chi.il.us> Date: 29 Apr 91 21:13:45 GMT References: <8283@alpha.cam.nist.gov> Organization: Chinet - Chicago Public Access UNIX Lines: 22 In article <8283@alpha.cam.nist.gov> coleman@cam.nist.gov (Sean Sheridan Coleman X5672) writes: >Is there a way from inside a C program to find out if >DATA CARRIER DETECT is high on the Data communication devices? >I want my program to see if there is a modem device on the >other end of the cable before it tries to use that port. >I am trying to make sure that the port plugged into the >back of my Sparc Station is hooked into something. First of all, a modem should not be asserting carrier detect unless it has a connection up with another modem. If you set it to keep carrier detect up all the time, then you can't tell when you actually have a connection. To test for carrier detect being asserted, all you have to do is set a short alarm and attempt an open. If the alarm hits before the open completes, you were blocked waiting for CD. Or, with Suns you can open with O_NDELAY and use their ioctl() extensions to retreive the modem status. Les Mikesell les@chinet.chi.il.us