MCPcopy Create free account
hub / github.com/Tencent/UnLua / inet_global_toip

Function inet_global_toip

Plugins/UnLuaExtensions/LuaSocket/Source/src/inet.cpp:129–142  ·  view source on GitHub ↗

-------------------------------------------------------------------------*\ * Returns all information provided by the resolver given a host name * or ip address \*-------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

127* or ip address
128\*-------------------------------------------------------------------------*/
129static int inet_global_toip(lua_State *L)
130{
131 const char *address = luaL_checkstring(L, 1);
132 struct hostent *hp = NULL;
133 int err = inet_gethost(address, &hp);
134 if (err != IO_DONE) {
135 lua_pushnil(L);
136 lua_pushstring(L, socket_hoststrerror(err));
137 return 2;
138 }
139 lua_pushstring(L, inet_ntoa(*((struct in_addr *) hp->h_addr)));
140 inet_pushresolved(L, hp);
141 return 2;
142}
143
144int inet_optfamily(lua_State* L, int narg, const char* def)
145{

Callers

nothing calls this directly

Calls 5

inet_gethostFunction · 0.85
lua_pushnilFunction · 0.85
lua_pushstringFunction · 0.85
inet_pushresolvedFunction · 0.85
socket_hoststrerrorFunction · 0.70

Tested by

no test coverage detected