资源暂时不可用于Boost ASIO

时间:2021-10-15 06:24:28

I get the error message "Resource temporarily unavailable" when I use the method receive_from(), it's a member of ip::udp::socket located here.

当我使用方法receive_from()时,我收到错误消息“资源暂时不可用”,它是位于此处的ip :: udp :: socket的成员。

I pass to it: boost::asio::buffer, pointer to an endpoint object, flags (set to zero), and an error_code object.

我传递给它:boost :: asio :: buffer,指向端点对象的指针,flags(设置为零)和error_code对象。

I create the endpoint with just

我用just创建端点

 new udp::endpoint()

There doesn't seem to be too much information available on this error message too. I've tried it on several machines and always get this error.

此错误消息似乎没有太多可用信息。我在几台机器上试过它并且总是得到这个错误。

1 个解决方案

#1


"Resource temporarily unavailable" is normally the text description for EAGAIN, indicating that the operation should be retried. In the case of UDP, it indicates that there isn't any data available at present, and you should try later.

“资源暂时不可用”通常是EAGAIN的文本描述,表示应该重试该操作。在UDP的情况下,它表示目前没有任何可用数据,您应该稍后再试。

It's generally worth looking at the man page for the underlying libc function; which is recvfrom in this case.

通常值得查看底层libc函数的手册页;在这种情况下,这是recvfrom。

#1


"Resource temporarily unavailable" is normally the text description for EAGAIN, indicating that the operation should be retried. In the case of UDP, it indicates that there isn't any data available at present, and you should try later.

“资源暂时不可用”通常是EAGAIN的文本描述,表示应该重试该操作。在UDP的情况下,它表示目前没有任何可用数据,您应该稍后再试。

It's generally worth looking at the man page for the underlying libc function; which is recvfrom in this case.

通常值得查看底层libc函数的手册页;在这种情况下,这是recvfrom。