測試luasocket
更新記錄
item | note |
---|---|
20160816 | 第一版 |
目錄
LuaSocket
LuaSocket is a Lua extension library that is composed by two parts:
- a C core that provides support for the TCP and UDP transport layers
1 | /local/lib/lua/5.1/mime/core.so |
- and a set of Lua modules that add support for functionality commonly needed by applications that deal with the Internet.
1 | ./local/share/lua/5.1/ltn12.lua |
http example
http.request()
api example
- [luasocket-3.0-rc1/doc/http.html1
1 | http.request(url [, body]) |
- test
1 | > require ("socket") |
Reference
item | note |
---|---|
DNS | getaddrinfo, gethostname, tohostname, toip. |
FTP | get, put. |
HTTP | request. |
LTN12 | filter: chain, cycle. |
pump: all, step. | |
sink: chain, error, file, null, simplify, table. | |
source: cat, chain, empty, error, file, simplify, string. | |
MIME | high-level: decode, encode, normalize, stuff, wrap. |
low-level: b64, dot, eol, qp, qpwrp, unb64, unqp, wrp. | |
SMTP | message, send. |
Socket | bind, connect, connect4, connect6, _DEBUG, dns, gettime, headers.canonic, newtry, protect, select, sink, skip, sleep, |
_SETSIZE, source, tcp, tcp6, try, udp, udp6, _VERSION. | |
TCP (in socket) | accept, bind, close, connect, dirty, getfd, getoption, getpeername, getsockname, getstats, listen, receive |
send, setfd, setoption, setstats, settimeout, shutdown. | |
UDP (in socket) | close, getoption, getpeername, getsockname, receive, receivefrom, send, sendto, setpeername, setsockname, setoption, settimeout. |
URL | absolute, build, build_path, escape, parse, parse_path, unescape. |