🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #6461

Re: Response not in que?

#6461
From: Remy Lebeau (TeamB)
Date: Mon, 09 May 2005 23:34
39 lines
2733 bytes
"Neil P." <nporve01@hotmail.com> wrote in message
news:427fd0af@newsgroups.borland.com...

> Well, I am using overlapped I/O.  The problem is that I don't
> want my code to lock up.

The thing about overlapped I/O is that you don't have to lock up your code.
Once you call ReadFile(), specifying an OVERLAPPED structure, ReadFile()
will return immediately and your code can go off to do other things while
the reading happens in the background.  Then your code can periodically
check the status of the event object inside the OVERLAPPED structure when it
has a chance to.  Once the event has been signaled, the reading has finished
and you can use GetOverlappedResult() to find out the result of the reading.

> If the other unit does not respond, I want the read function to quit,
> but what is a good time to quit?

Your use of CheckCommStatus() to poll the serial port status could be
slowing the code down.  If you get rid of it entirely and just let the
overlapped I/O do the work for you, you'll probably notice that your unit's
responses come through a lot faster.  You know that the unit should be
sending a byte back to you, so just perform an overlapped reading
immediately after you finish writing, and you will still be able to detect
when the reading has completed.

> How about if I dishout an application that works well with this unit,
> under the environment I am in, but when the user gets it, the unit or
> my application seems that it is lockout

That would suggest to me that your code is not set up to handle the serial
port properly.

> because he/she has a pentium 100, operating on Win95

Overlapped I/O on a serial port works fine on Win9x.


Gambit
Technical Details
Message-ID: <427ff371$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <427fa27e@newsgroups.borland.com> <vugv711ona1kdbekucqqkg6csqkcd4agrd@4ax.com> <427fca8b$1@newsgroups.borland.com> <427fce92$1@newsgroups.borland.com> <427fd0af@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,369fa724017da622
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <427fa27e@newsgroups.borland.com> <vugv711ona1kdbekucqqkg6csqkcd4agrd@4ax.com> <427fca8b$1@newsgroups.borland.com> <427fce92$1@newsgroups.borland.com> <427fd0af@newsgroups.borland.com>
Subject: Re: Response not in que?
Date: Mon, 9 May 2005 16:34:55 -0700
Lines: 41
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <427ff371$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1115681649 68.69.17.41 (9 May 2005 16:34:09 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail