本文整理汇总了C++中IPAddress::setWithDNS方法的典型用法代码示例。如果您正苦于以下问题:C++ IPAddress::setWithDNS方法的具体用法?C++ IPAddress::setWithDNS怎么用?C++ IPAddress::setWithDNS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPAddress
的用法示例。
在下文中一共展示了IPAddress::setWithDNS方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Read
bool LUAIPAddress::Read(Exception& ex, lua_State *pState, int index, IPAddress& address,bool withDNS) {
if (lua_type(pState, index)==LUA_TSTRING) // lua_type because can be encapsulated in a lua_next
return withDNS ? address.setWithDNS(ex, lua_tostring(pState,index)) : address.set(ex, lua_tostring(pState,index));
if(lua_istable(pState,index)) {
bool isConst;
IPAddress* pOther = Script::ToObject<IPAddress>(pState, isConst, index);
if (pOther) {
address.set(*pOther);
return true;
}
SocketAddress* pAddress = Script::ToObject<SocketAddress>(pState, isConst, index);
if (pAddress) {
address.set(pAddress->host());
return true;
}
ServerConnection* pServer = Script::ToObject<ServerConnection>(pState, isConst, index);
if (pServer) {
address.set(pServer->address.host());
return true;
}
}
ex.set(Exception::NETADDRESS, "No valid IPAddress available to read");
return false;
}