Thread: Checking for incomming data on the serial port with Boost Asio?

  1. #1
    Algorithm engineer
    Join Date
    Jun 2006
    Posts
    286

    Checking for incomming data on the serial port with Boost Asio?

    How can I check if there is any incoming data to a boost::asio::serial_port? If there is no data, the program shouldn't read anything, and instead continue with other activities. Hence, to check for the data I cannot use the read function since it would lock my program until any data has arrived.
    Come on, you can do it! b( ~_')

  2. #2
    Algorithm engineer
    Join Date
    Jun 2006
    Posts
    286

    Lightbulb

    Answer: Use the async functions instead. They will start asynchronous read/write/wait operations and return so your other code can continue to run meanwhile. The will give you interrupts later, when the operation has finished. If you use boost asio, just remember to run io.run() (where io is your io_service object) to get the interrupts.
    Come on, you can do it! b( ~_')

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling C in Visual Studio 2005
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-16-2009, 04:25 AM
  2. Comodo Firewall Vulnerability (Port 0)
    By Mario F. in forum Tech Board
    Replies: 0
    Last Post: 11-11-2009, 08:56 AM
  3. Lame null append cause buffer to crash
    By cmoo in forum C Programming
    Replies: 8
    Last Post: 12-29-2008, 03:27 AM
  4. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM

Tags for this Thread