luafan

fan.tcpd

conn = tcpd.connect(arg:table)

connect to remote tcp server.


keys in the arg:


conn apis:

send(buf)

send out data buf.

close()

close connection, ondisconnected may not callback.

reconnect()

reconnect to the destination.

pause_read()

pause onread callback.

resume_read()

resume onread callback.


serv = tcpd.bind(arg:table)

listening on tcp socket.


serv apis


keys in the arg:

AcceptConnection

send(buf)

send data buf to client.

close()

close client connection.

flush()

flush data to client.

remoteinfo()

return the client connection info table. {ip = "1.2.3.4", port = 1234}

pause_read()

pause onread (from bind) callback.

resume_read()

resume onread (from bind) callback.

bind(arg:table)

working on single connection.


keys in the arg: