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

Function meth_send

Plugins/UnLuaExtensions/LuaSocket/Source/src/unixdgram.cpp:114–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114static int meth_send(lua_State *L)
115{
116 p_unix un = (p_unix) auxiliar_checkclass(L, "unixdgram{connected}", 1);
117 p_timeout tm = &un->tm;
118 size_t count, sent = 0;
119 int err;
120 const char *data = luaL_checklstring(L, 2, &count);
121 timeout_markstart(tm);
122 err = socket_send(&un->sock, data, count, &sent, tm);
123 if (err != IO_DONE) {
124 lua_pushnil(L);
125 lua_pushstring(L, unixdgram_strerror(err));
126 return 2;
127 }
128 lua_pushnumber(L, (lua_Number) sent);
129 return 1;
130}
131
132/*-------------------------------------------------------------------------*\
133* Send data through unconnected unixdgram socket

Callers

nothing calls this directly

Calls 8

auxiliar_checkclassFunction · 0.85
luaL_checklstringFunction · 0.85
timeout_markstartFunction · 0.85
lua_pushnilFunction · 0.85
lua_pushstringFunction · 0.85
unixdgram_strerrorFunction · 0.85
lua_pushnumberFunction · 0.85
socket_sendFunction · 0.70

Tested by

no test coverage detected