Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 23rd, 2005, 09:04 PM
Authorized User
Join Date: Mar 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default How do I know when no data is @ Serial Port?

This is actually a generalized question, but I am writing in C++, so I am putting it here:

In regards to Reading from the serial port in C++ using the Win32 API: Is there a way to know when there is no data to be read from the port without using flow control? Basically my situation is this: I am just passively reading from the serial port, I never send any data, just receive it. So I just want to read from the port until there is nothing more to be read, then go do something with the data I read, then go back and read some more. Currently, I was using a timer (specifically SetTimer()) to call the read function every 100ms, however, I was missing a lot of data this way, so I am looking for a way that would allow for all data to be receieved and buffered correctly. My connection is 115200 baud with 0% error rate, so it is simply my read function that is causing the missed data.

If anyone could lend some suggestions it will be greatly appreciated.


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I send raw data directly to a serial port peterasimpson VB.NET 0 January 27th, 2008 09:42 PM
serial port humayun Linux 0 February 20th, 2006 01:53 AM
Serial Port johnjohn Access VBA 2 November 19th, 2004 02:53 PM
Serial Port johnjohn Classic ASP Databases 1 November 16th, 2004 03:08 AM
Serial Port In C NET4JAGMOHAN C++ Programming 1 January 30th, 2004 07:56 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.