diff --git a/mongoose.c b/mongoose.c
index 993152cf6bc38d3dbea89c7d389973c4bc2c3cc8..3c7addd86732e1106ae9bad11c2b9a5689f24b82 100644
--- a/mongoose.c
+++ b/mongoose.c
@@ -5377,7 +5377,7 @@ static int lsp_sock_send(lua_State *L) {
       }
       sent += n;
     }
-    lua_pushnumber(L, n);
+    lua_pushnumber(L, sent);
   } else {
     return luaL_error(L, "invalid :close() call");
   }