| 1 | socket=require("socket"); |
| 2 | os.remove("/tmp/luasocket") |
| 3 | socket.unix = require("socket.unix"); |
| 4 | host = host or "luasocket"; |
| 5 | server = assert(socket.unix()) |
| 6 | assert(server:bind(host)) |
| 7 | assert(server:listen(5)) |
| 8 | ack = "\n"; |
| 9 | while 1 do |
| 10 | print("server: waiting for client connection..."); |
| 11 | control = assert(server:accept()); |
| 12 | while 1 do |
| 13 | command = assert(control:receive()); |
| 14 | assert(control:send(ack)); |
| 15 | ((loadstring or load)(command))(); |
| 16 | end |
| 17 | end |