Article View: borland.public.cppbuilder.nativeapi
Article #15549Re: eternal 'ReadIntervalTimeOut' com port
From: Remy Lebeau (TeamB)
Date: Tue, 24 Jun 2003 21:49
Date: Tue, 24 Jun 2003 21:49
24 lines
1912 bytes
1912 bytes
"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:
<3ef8c673$3@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!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3ef8bbd6@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,42e81fe87bbd2b5d X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-06-24 15:23:05 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3ef8bbd6@newsgroups.borland.com> Subject: Re: eternal 'ReadIntervalTimeOut' com port Date: Tue, 24 Jun 2003 14:49:33 -0700 Lines: 26 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: 207.175.226.26 Message-ID: <3ef8c673$3@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1056491123 207.175.226.26 (24 Jun 2003 14:45:23 -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!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail