tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* SUMMARY: select on COM port
@ 1997-03-21  8:50 mgaluza
  0 siblings, 0 replies; only message in thread
From: mgaluza @ 1997-03-21  8:50 UTC (permalink / raw)
  To: tru64-unix-managers

Thanks to the following for their responses.

Dejan Muhamedagic <muja@galeb.etf.bg.ac.yu>
Lars Bro, lab@dscc.dk
"Jeffrey G. Micono 6533 (Ktech)" <jgmicon@sandia.gov>

Here is my original question:

> Hello.  This question is more of a programming question so it may not 
> be appropriate for this list.  If that's true, I apologize ahead of 
> time.  Anyway, I'm having trouble doing a select() on a COM port.  I 
> open /dev/tty00 with Read/Write permissions then do a select on it, but 
> it never comes back.  I know the port is working okay because if I skip 
> the select and just read or write the fd it works fine.  Does anyone
> out there know if it is possible to do a select() on an RS232 connection? 
> And if so, is there anything special you have to do that I might be 
> missing?

The response from Jeffrey G. Micono seems to have summed up the answer.

> Mike,
> 
> I kinda remember stumbling on this on an Ultrix box. Basically,
> I was trying to select from both a socket descrip and a terminal
> descrip.
> 
> On Ultrix, this doesn't work.  select did not work for character
> special devices or files.
> 
> Fortunately, you have other options in DU. If you are willing to
> make your app multi-threaded, you can use regular old blocking
> reads in separate threads for each fd.  This gets rid of having
> to use select and makes each thread very simple.  The down side
> is that you now have reentrancy and thread safety to be aware of
> (and some possibly pretty hairy debugging sessions)
> 
> If you must use one thread and select, you may have to write
> a "shim" process that reads from the com port (using blocking
> reads) and writes to a unix domain socket (or a socket on the
> loopback ethernet).  Then, your main program can select on the
> unix domain socket and other sockets.
> 

Since I am trying to do precisely what Jeffrey spoke of (doing a
select on both a socket and a terminal descrip) I think I am having
the same problem.  I will probably use a thread to do a blocking read
on the on the com port and then write whatever it gets to a socket
where my main process will be hanging a select. Shouldn't be too
tough.

Oh, I almost forgot, I also downloaded the C-Kermit source code to see
if it uses select.  From what I could tell it didn't use select the
way I need it on a com port, only on a socket.

Thanks,
again
     
----------------------------------------------------------------------
Michael Galuza
DeJarnette Research Systems                  mgaluza@dejarnette.com 
401 Washington Ave  Suite 700                Voice: +1(410)583-0680 x691
Towson, MD 21204                             Fax:   +1(410)583-0696
----------------------------------------------------------------------

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-03-21  8:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-03-21  8:50 SUMMARY: select on COM port mgaluza

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox