LuaEngine/TCP.h

22 lines
618 B
C
Raw Normal View History

2020-05-29 01:39:49 +08:00
#include "Socket.h"
2020-05-23 01:11:46 +08:00
/*
class TCPSocket
2020-05-24 05:24:13 +08:00
constructor(nonblocking: boolean)
2020-05-23 01:11:46 +08:00
close()
2020-05-24 05:24:13 +08:00
setblocking(nonblocking: boolean)
2020-05-23 01:11:46 +08:00
listen([ip: string], port: int, [backlog: int]) Address default to 0.0.0.0, backlog default to 10.
2020-05-29 01:39:49 +08:00
# Blocking mode: All unexpected error will be raised as exception.
2020-05-23 01:11:46 +08:00
connect(ip: string, port: int)
accept(): TCPSocket PeerIP PeerPort
send(data: string) All data will be sent before return.
recv([maxsize: int]): string. Default to 4KB.
# Non-blocking mode:
connect(ip: string, port: int)
accept(): (TCPSocket PeerIP PeerPort) or nil
send(data: string)
recv([maxsize: int]): string
*/