Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Serial port: How to reset ::WaitCommEvent() in non-overlapped mode

$
0
0

Once the ::WaitCommEvent() is called such as this:

::SetCommMask(m_hCommPort,EV_RXCHAR);

::WaitCommEvent(apThis->m_hCommPort,&dwEventMask, NULL );

//This will block the thread until of course there is data at the receiving

//then ::ReadFile() is called to read the data until no more is read.

do

{

::ReadFile(apThis->m_hCommPort,&byrcv,1,&dwBytesRead, NULL)

}while (dwBytesRead >0)

//so once ::ReadFile() is done, it will loopback to ::WaitCommEvent()

//but this time, ::WaitCommEvent() is no longer blocking which is not

//good.  So how can I reset ::WaitCommEvent() so that it will be waiting

//for new receiving data again.  Notice that is is non-overlapped operations.


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>