| 112 | } |
| 113 | |
| 114 | static 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 |
nothing calls this directly
no test coverage detected