c++ - boost::asio::local::stream_protocol::acceptor 抛出错误

标签 c++ boost boost-asio

我正在尝试像这样使用 boost::asio::local::stream_protocol::acceptor :

accept_(getIOService(), endpoint_)

这个调用返回的错误是:

[exec] unknown file: Failure
[exec] C++ exception with description "bind: No such file or directory" thrown in the test body.

有人见过这个吗?

最佳答案

验证端点的路径是否正确。当我通常观察到这些错误时,这是​​一个路径相关的问题,例如当当前目录中不存在 tmp 目录时,使用 "tmp/example" 构造端点,因为我打算使用 "/tmp/example"

Boost.Asio 的异常(exception)是从 bind() 接收 ENOENT 的转换。 bind() 的手册页声明 ENOENT 表示:

A component of the pathname does not name an existing file or the pathname is an empty string.

关于c++ - boost::asio::local::stream_protocol::acceptor 抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15124836/

相关文章:

c++ - QTcpServer::incomingConnection(qintptr socketDescriptor) 是否可以连接指定的套接字?

c++ - Boost、共享内存和 vector

ssl - 仅关闭 TLS 连接

c++ - 在 VSCode 中调试 C++ 期间将输入传递给 std::cin 的问题

c++ - 类或函数声明中间的宏

c++ - 如何查找已安装的驱动器是否确实存在于 Mac 上

c++ - boost Asio : Some questions about the tutorial (A synchronous daytime server/client)

c++ - 如果两个线程同时访问同一个 bool 变量会发生什么?

c++ - 友元与继承

c++ - 将具有 xml 属性的子树添加到 boost 属性树