UPDATE: select on COM port

From: Mike Galuza <mgaluza_at_dejarnette.com>
Date: Mon, 24 Mar 97 17:23:04 EST

It turns out that you CAN do a select on a COM port. I took a look
at the mgetty source code as Rob Urban had suggested. Although I
didn't see any glaring errors at first glance I did see a few subtle
things they were doing differently. One involved the first parameter
to select, nfds (number of fds). I was passing one, while they were
passing FD_SETSIZE, the system maximum. I tried using that value and
it worked! After some experimenting I found that any value greater
than 3 worked. It took me a while to figure it out, but I think the
problem is that stdin, stdout and stderr take up the first 3 fds, and
my fd is the 4th. So when I pass 1 to select it only looks at the
first fd, stdin. I have to pass 4 for nfds so that mine is seen.
Alternatively, I closed stdin before opening my fd and then my fd was
0 and was seen as the first one, so an nfds of 1 works in that case.
Anyway, having select available will save me a lot of work.

Thanks,
Mike

----------------------------------------------------------------------
Michael Galuza
DeJarnette Research Systems mgaluza_at_dejarnette.com
401 Washington Ave Suite 700 Voice: +1(410)583-0680 x691
Towson, MD 21204 Fax: +1(410)583-0696
----------------------------------------------------------------------
Received on Mon Mar 24 1997 - 23:33:55 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:36 NZDT