Xref: utzoo comp.unix.questions:30667 comp.unix.wizards:25085 comp.unix.internals:2604 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uunet!rbj From: rbj@uunet.UU.NET (Root Boy Jim) Newsgroups: comp.unix.questions,comp.unix.wizards,comp.unix.internals Subject: Re: determining if DCE device is ready Message-ID: <130199@uunet.UU.NET> Date: 23 Apr 91 21:06:28 GMT Article-I.D.: uunet.130199 References: <8272@alpha.cam.nist.gov> Followup-To: comp.unix.questions Organization: UUNET Communications Services, Falls Church, VA Lines: 20 coleman@cam.nist.gov (Sean Sheridan Coleman X5672) writes: >I am working on a program that uses the tty serial lines. i >would like to be able from my program to sense if the DCE (Data >Communication Equipment) is at the other end and running, ie >i dont want to have the program connect to a port that has >nothing plugged into it. Is there a way to see if DATA CARRIER >DETECT is high at the DCE end from a C program. If there is no carrier, you won't be able to open the port. Just poll each device (with open(dev,O_NDELAY) every so often. Or you can get trickier. Fork a child for each device you want to open. The child will block on the open. When the carrier comes on, the open will succeed. Have the child exit, which will then send a death of child signal to the parent. The parent will then open the device (in non blocking mode, just in case). -- [rbj@uunet 1] stty sane unknown mode: sane