Boost logo

Boost Users :

Subject: [Boost-users] [asio] async udp socket latency
From: Andrew Hundt (athundt_at_[hidden])
Date: 2015-07-02 03:12:25

I'm having difficulty with latency when running an async asio udp socket. I
don't have the same problems with an identical application that uses
synchronous udp. I'm communicating with a physical device which permits a
maximum 5ms latency for each UDP packet, and I'm currently getting a
latency of 8ms with a std dev of 0.065ms which is surprisingly precise.

I'm on Mac OS X 10.10.4 with Xcode 6.3.2 (6D2105).

Here are some of the key details about this problem:

   - Sync UDP test program
      - works, staying under 5ms latency 100% of the time for over an hour
      - Code
         - main file KukaFRIClientDataTest.cpp
         - UDP socket communication class KukaFriClientData.hpp
      - Key lines
         - calls socket.receive_from() then socket.send() at the lowest
         - receive_from call
         - send call

   - Async UDP test program
      - buggy, 8ms w/ 0.065 ms std dev, continuously high latency
      - Code
         - main file KukaFRITest.cpp
         - High level wrapper class KukaFRIThreadSeparator.hpp
         - Low level wrapper class KukaFRI.hpp
      - Key lines
         - calls socket_.async_receive_from() then that handler calls
         socket_.async_send_to(), which calls the final callback with the
         - async_receive_from call
         - async_send_to_call

Does anyone have insight into why this latency issue may be occurring in
the Async UDP version? Thanks.

Andrew Hundt

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at