Asyncronus wrapper around LuaSocket library
The idea is taken from lua-memcached
#API
Create tcp client socket.
Create udp client socket.
Connect the socket to the specified host/port.
Disconnect the socket.
Binds the socket to the specified host/port.
Set peername for socket.
Clear peername on the socket.
Set sockname on the socket.
##Usage
local async_socket = require "async_socket"
--
local cnt = 0
function idle() cnt = cnt + 1 end
local cnn = async_socket.tcp_client(idle)
local ok = assert(cnn:connect(nil, HOST, PORT))
print("CONNECT:",cnt)
cnn:send(5, MESSAGE)
print("SEND:",cnt)
MESSAGE = cnn:recv(5)
print("RECV:", cnt)
cnn:close()
Using async socket with lua-pop3 library - async_pop3.lua