MCPcopy Create free account
hub / github.com/apache/thrift / l_socket_getsockinfo

Function l_socket_getsockinfo

lib/lua/src/luasocket.c:285–300  ·  view source on GitHub ↗

table getsockinfo()

Source from the content-addressed store, hash-verified

283
284// table getsockinfo()
285static int l_socket_getsockinfo(lua_State *L) {
286 char buf[256];
287 short port = 0;
288 p_tcp tcp = (p_tcp) checktype(L, 1, SOCKET_ANY);
289 if (socket_get_info(&tcp->sock, &port, buf, 256) == SUCCESS) {
290 lua_newtable(L); // t
291 lua_pushstring(L, "host"); // t, "host"
292 lua_pushstring(L, buf); // t, "host", buf
293 lua_rawset(L, -3); // t
294 lua_pushstring(L, "port"); // t, "port"
295 lua_pushnumber(L, port); // t, "port", port
296 lua_rawset(L, -3); // t
297 return 1;
298 }
299 return 0;
300}
301
302////////////////////////////////////////////////////////////////////////////////
303// Server

Callers

nothing calls this directly

Calls 2

checktypeFunction · 0.85
socket_get_infoFunction · 0.85

Tested by

no test coverage detected