当前位置: 代码迷 >> Brew >> INETMGR_GetMyIPAddr 取得的 IP 有时候有 有时候为0
  详细解决方案

INETMGR_GetMyIPAddr 取得的 IP 有时候有 有时候为0

热度:6932   发布时间:2013-02-26 00:00:00.0
INETMGR_GetMyIPAddr 获得的 IP 有时候有 有时候为0?

INETMGR_GetMyIPAddr( inetmgr);

为什么 这个函数的返回值大多说情况下我总得到0? 

真机上也是0。

前面除了ISHELL_CreateInstance 个 INETMGR 外 还需要做其他的么?
------解决方案--------------------------------------------------------
没有使用过,帮你顶。
------解决方案--------------------------------------------------------
 有人反映必须在GetHostByName()之后调用,不知道是不是真的。
------解决方案--------------------------------------------------------
直接ip的话就不用域名解析了,用INETMGR_GetHostByName()可以
------解决方案--------------------------------------------------------
 嗯 谢谢大家 。查到了 return 0 is ppp down

从https://developer.brewmp.com/forum 找到的 希望对大家有用。
What state is the device in when you try to obtain the IP address? Remember that in order for the network to assign an IP address to the device, you have to establish a PPP session. The best way to do that is probably to open a socket and bind to it.