An open API service indexing awesome lists of open source software.

https://github.com/hubenchang0515/diana

Diana is a Lua utility library in Linux , has IO SOCKET etc
https://github.com/hubenchang0515/diana

io linux lua socket

Last synced: 2 months ago
JSON representation

Diana is a Lua utility library in Linux , has IO SOCKET etc

Awesome Lists containing this project

README

          

# Diana
Diana is a Lua utility library , has IO SOCKET etc
*Hasn't been ready*

## Demo
```Lua
#! /usr/bin/env lua
local socket = require("diana.socket")
local signal = require("diana.signal")

local listen = socket.tcp()

signal.set(signal.SIGINT, function() listen:close() os.exit() end)

if listen:bind('0.0.0.0',80) and listen:listen() then
while true do
local x,addr = listen:accept()
if x == nil then
break
end

print(addr)
x:write("HTTP/1.1 200 OK\n")
x:write("Content-Type: text/html\n\n")
x:write("

Hello Diana

")
x:close()
end
else
print(listen:error())
listen:close()
end
```