getaddrinfo error设备或资源繁忙

时间:2016-12-27 14:50:30

标签: c coap dtls

我正在尝试运行FreeCoap(https://github.com/keith-cullen/FreeCoAP),以便能够与Intel Galileo gen上的COAP和DTLS进行通信。 2板。我已经看到开箱即用的测试编译并正确运行(只要我现在能够测试)。

我已经看到它准备在IPv6上运行。我不是它的专家,但我已经看到它的值主机配置为:: 1,我理解的是localhost。当我尝试将其更改为IPv4时,即127.0.0.1或板的实际IP地址,我收到错误。

我已经看到它使用netdb.h来创建服务器。

#include <netdb.h> 
...    
#define HOST                 "127.0.0.1"  /**< Host address to listen on */
#define PORT                 "12436"  
...

unsigned char msg_id[2] = {0};
struct addrinfo hints = {0};
struct addrinfo *list = NULL;
struct addrinfo *node = NULL;

hints.ai_flags = 0;
hints.ai_family = AF_INET;      /* value = 2 preferred socket domain */
hints.ai_socktype = SOCK_DGRAM;  /* value = 3 preferred socket type */
hints.ai_protocol = 0;           /* preferred protocol (3rd argument to socket()) - 0 specifies that any protocol will do */
hints.ai_addrlen = 0;            /* must be 0 */
hints.ai_addr = NULL;            /* must be NULL */
hints.ai_canonname = NULL;       /* must be NULL */
hints.ai_next = NULL;            /* must be NULL */
ret = getaddrinfo(HOST, PORT, &hints, &list);

作为getaddrinfo的结果,我得到的是-16值,表示以下错误:

Error  : Device or resource busy

我尝试使用netstat -a进行搜索,并且没有使用此类端口。

我缺少什么?什么资源很忙,不允许我获取地址?

0 个答案:

没有答案