TimeOut Serial Port

Discussion in 'C++' started by Steffen, Dec 1, 2004.

  1. Steffen

    Steffen Guest

    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
    Steffen, Dec 1, 2004
    #1
    1. Advertising

  2. Steffen wrote:
    > 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
    Victor Bazarov, Dec 1, 2004
    #2
    1. Advertising

  3. Steffen

    Steffen Guest

    Thank you very much!
    I will try it in an other newsgroup.

    Steffen
    Steffen, Dec 1, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rasha
    Replies:
    0
    Views:
    1,697
    Rasha
    Mar 17, 2005
  2. Pom
    Replies:
    2
    Views:
    1,656
    Bas-i
    Jan 31, 2007
  3. Max Kotasek
    Replies:
    4
    Views:
    984
    Max Kotasek
    Apr 9, 2010
  4. Mark Probert

    Timeout::timeout and Socket timeout

    Mark Probert, Oct 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    1,281
    Brian Candler
    Oct 6, 2004
  5. msalerno
    Replies:
    3
    Views:
    410
    Ilmari Karonen
    Jul 14, 2005
Loading...

Share This Page