Based on boost asio docs