Article View: borland.public.cppbuilder.nativeapi
Article #6476Re: Response not in que?
From: Neil P.
Date: Wed, 11 May 2005 17:34
Date: Wed, 11 May 2005 17:34
52 lines
3380 bytes
3380 bytes
First, I like to thank both of you, for helping me out. Second, I believe that both of you are right in your asumptions to a degree. The reason I say to a degree, is because I have not shown how I am setting the port and ReadTimeIntervals. I am sorry for that? Is like showing people bits of a puzzle and not the whole picture!! I am very hesitant in getting rid of ClearCommError(), I think it is a nice function, because it prevents having to do reads if there is nothing to read? > Then that suggests your code really is not set up properly, if it is taking > up to 10 seconds to get that response. I am still of the opinion that you > need to get rid of ClearCommError() altogether, for the purpose of polling > thequeue status anyway. If the code still runs slowly after removing it, > then something else is still messed up in your remaining code. My guess > would be that either 1) you did not actually configure the baud rate > correctly in your code, or 2) you did not set up the timeouts properly when > you opened the serial port. But I cannot say for sure, because you never > showed any of that code yet. > You are not using overlaped I/O properly to begin with, because you are > relying on your queue status and not the overlapped status. For that > matter, since your code is processing in a serialized manner anyway, your > Read() method can't return until the reading actually finsihes, so why are > you using overlapped I/O at all? It is not gaining you anythig in this > situation, so you could just remove it altogether and let ReadFile() operate > synchronously instead. I believe your absolutely correct on this, I have overlaped I/O, but why should I use it if I have another mean of coming out and prevent that my application from hanging. In addition, and please correct me if I am wrong, but in my timeout // Set a safety timeout dwRead_Time_Out = GetTickCount() + (iExpected*2); (iExpected*2) is a millisecond count I am adding to GetTickCount(), because if not this means what I am thinking is happening, it is not really happening. Thank you, Neil P.
Technical Details
Message-ID:
<4282440b$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!diablo.voicenet.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<427fa27e@newsgroups.borland.com> <vugv711ona1kdbekucqqkg6csqkcd4agrd@4ax.com> <427fca8b$1@newsgroups.borland.com> <427fce92$1@newsgroups.borland.com> <427fd0af@newsgroups.borland.com> <427ff371$1@newsgroups.borland.com> <42820cad$1@newsgroups.borland.com> <42823b43$1@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: "Neil P." <nporve01@hotmail.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> <427ff371$1@newsgroups.borland.com> <42820cad$1@newsgroups.borland.com> <42823b43$1@newsgroups.borland.com> Subject: Re: Response not in que? Date: Wed, 11 May 2005 13:34:24 -0400 Lines: 54 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 68.209.111.59 Message-ID: <4282440b$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1115833355 68.209.111.59 (11 May 2005 10:42:35 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!diablo.voicenet.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail