求救,怎么获取手机上的本地IP地址啊??
求救,怎么获取手机上的本地IP地址啊??有没有源码贴出来看一下,多谢了!!
[解决办法]
Hi, try this, it has worked for me:
RSocketServ m_SocketServ;
RConnection m_Connection;
TNameEntry m_NameEntry;
RHostResolver m_HostResolver;
m_Connection.Open(m_SocketServ);
m_Connection.Start(status);
User::WaitForRequest(status);
m_HostResolver.Open(m_SocketServ,KAfInet,KProtocolInetUdp);
m_HostResolver.GetHostName(buf);
mHostResolver.GetByName(buf,m_NameEntry,status);
User::WaitForRequest(status);
And you should have your localIP in your m_NameEntry variable
I hope that helps