TimeOut Serial Port

S

Steffen

Hello!

I'm excanging data with an microcontroller (Atmel) via the serial port.

My C++ programm is written in Microsoft Visual Studio .net (7)
I have the following problem:

If I disconnect my controller, then the programm hangs up in the following
line:
WaitCommEvent (m_hCommPort, &dwEvtMask, 0);

Of course it does - but I need to get a TimeOut. After 50 ms the function
should quit and return an timeout message.

Can anybody help me? Would really be great.
Thank you in advance!
Best regards
Steffen
 
V

Victor Bazarov

Steffen said:
I'm excanging data with an microcontroller (Atmel) via the serial port.

My C++ programm is written in Microsoft Visual Studio .net (7)
I have the following problem:

If I disconnect my controller, then the programm hangs up in the following
line:
WaitCommEvent (m_hCommPort, &dwEvtMask, 0);

Of course it does - but I need to get a TimeOut. After 50 ms the function
should quit and return an timeout message.

Can anybody help me? Would really be great.

AFAICT, 'WaitCommEvent' is not a standard C++ function. Your best bet is
to ask about it in a newsgroup dedicated to your OS or your compiler. For
VC++.NET try comp.os.ms-windows.programmer.* or microsoft.public.vc.*

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top