www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/02/19/12:45:12

From: kdd21 AT hotmail DOT com (Keith Doyle)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: COM1: always non-blocking?
Date: 19 Feb 2003 09:38:41 -0800
Organization: http://groups.google.com/
Lines: 40
Message-ID: <3593a281.0302190938.3ea1266@posting.google.com>
References: <4D19136444628A40840EFE8C5AE04147017A30 AT ELTIMAIL1 DOT elta DOT co DOT il>
NNTP-Posting-Host: 66.120.46.138
X-Trace: posting.google.com 1045676322 29402 127.0.0.1 (19 Feb 2003 17:38:42 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 19 Feb 2003 17:38:42 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Zaretskii Eli <ezaretski AT elta DOT co DOT il> wrote in message news:<4D19136444628A40840EFE8C5AE04147017A30 AT ELTIMAIL1 DOT elta DOT co DOT il>...
> This message was scanned for viruses and other malicious code by PrivaWall.
> 
> 
> This mail was sent from ELTA SYS LTD.
> 
> 
> > From: Keith Doyle [mailto:kdd21 AT hotmail DOT com] 
> > Sent: Tuesday, February 18, 2003 10:01 PM
> > 
> > So, I gave up on dzcomm, bcserio,pmcom, etc..  I then thought for a
> > moment, that under a DOS window you can do something as simple as
> > "echo 'hello' >COM1" so why not just trying to do an open on COM1:.
> 
> You don't need to do that, actually: file descriptor 3 is already
> preconnected to the COM1 port, and the stdaux FILE object is open on
> that descriptor.  Just use them.
> 
> > Well, it worked pretty good.  The only gotcha seems to be that read
> > appears to always be NONBLOCKING
> 
> Please explain what you mean by this.  DJGPP generally doesn't support
> non-blocking I/O (since it requires a multiprocessing OS).

A call to read() returns immediately whether or not there is a
character, if there is none it returns 0, so I can just loop until
read() > 0 and I can get the chars.  It would appear to be a polling
loop that way however, and according to a previous poster, could
"miss" characters if not called quickly enough or, supposedly at rates
above 9600.  Since my application is at 9600 and I don't need the
system to do anything else at the time, and it is not for public
consumption, none of these possible drawbacks are show stoppers.

I'm not going to switch to a serial library, as opening COM1: works. 
However, if it would be possible to get it to block in the read()
call, I would make use of that...

--

Keith Doyle

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019