net/servertests/server.lua
Ryan Ward 859ae91395 Reworking the library
netold contains the older library. the new library has all the core features that  was in the old library.
2018-06-15 11:29:27 -04:00

26 lines
503 B
Lua

require("socket")
ssl=require("ssl")
-- TLS/SSL server parameters (omitted)
local params = {
mode = "server",
protocol = "tlsv1_2",
key = "certs/serverAkey.pem",
certificate = "certs/serverA.pem",
cafile = "certs/rootA.pem",
verify = "peer",
options = "all"
}
local server = socket.tcp()
server:bind("127.0.0.1", 8888)
server:listen()
local conn = server:accept()
-- TLS/SSL initialization
conn = ssl.wrap(conn, params)
print(conn:dohandshake())
--
conn:send("one line\n")
conn:close()