mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-11-08 22:38:21 +01:00
4b671f4551
Conflicts in options.c were just due to independent small functions being close to each other. unix.c in mwild was broken, it wasn't using LUASOCKET_API. serial.c needed luaL_reg renamed, and to use LUASOCKET_API. makefile didn't respect standard DESTDIR and prefix makefile variables, and didn't allow LUAV variable to select lua version to build against. I've tested the top-level install-both target builds and installs against both lua5.1 and lua5.2, but not done further testing. Conflicts: README config gem/ltn012.tex makefile src/makefile src/options.c src/options.h src/tcp.c src/usocket.c
21 lines
510 B
Lua
21 lines
510 B
Lua
socket = require("socket");
|
|
host = host or "localhost";
|
|
port = port or "8383";
|
|
server = assert(socket.bind(host, port));
|
|
ack = "\n";
|
|
while 1 do
|
|
print("server: waiting for client connection...");
|
|
control = assert(server:accept());
|
|
while 1 do
|
|
command, emsg = control:receive();
|
|
if emsg == "closed" then
|
|
control:close()
|
|
break
|
|
end
|
|
assert(command, emsg)
|
|
assert(control:send(ack));
|
|
print(command);
|
|
(load(command))();
|
|
end
|
|
end
|