Article View: borland.public.cppbuilder.nativeapi
Article #15551Re: eternal 'ReadIntervalTimeOut' com port
From: david
Date: Tue, 24 Jun 2003 22:29
Date: Tue, 24 Jun 2003 22:29
45 lines
2246 bytes
2246 bytes
oooooooooooooooooooops! thank you I appreciate your help. In fact, there was an unrearchable code warning message, now it's working ok. David "Remy Lebeau (TeamB)" <gambit47@yahoo.com> escribi๏ฟฝ en el mensaje news:3ef8c673$3@newsgroups.borland.com... > > "david" <dmarquezl@hotmail.com> wrote in message > news:3ef8bbd6@newsgroups.borland.com... > > > I'm trying to use the com port, but when I read this buffer and there are > > not data, the handle don`t return the control to the next code line. > > Its not supposed to. You're reading the port synchronously and you never > set the timeouts for the port, thus it is just going to sit there until data > is available. You should be using overlapped I/O for the reading. Have a > look at the OVERLAPPED structure and the GetOverlappedResult() function. > > > if( hCom == INVALID_HANDLE_VALUE ) > > return false; > > else > > return true; > > You're never going to reach the rest of your code because you are returning > too soon. Thus you never get a chance to set the timeouts. Didn't the > compiler warn you about "unreachable code"? Get rid of the second 'return' > statement. > > > Gambit > >
Technical Details
Message-ID:
<3ef8cf37@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3ef8bbd6@newsgroups.borland.com> <3ef8c673$3@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10cc67,42e81fe87bbd2b5d X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-06-24 16:03:49 PST From: "david" <dmarquezl@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3ef8bbd6@newsgroups.borland.com> <3ef8c673$3@newsgroups.borland.com> Subject: Re: eternal 'ReadIntervalTimeOut' com port Date: Tue, 24 Jun 2003 18:29:31 -0400 Lines: 47 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 200.50.121.180 Message-ID: <3ef8cf37@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1056493367 200.50.121.180 (24 Jun 2003 15:22:47 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail