net_server
简介
网络模块
组件接口
FCmdBase.gs
消息组件
函数原型 | 函数作用 |
---|---|
string cmd_name() | 获取消息名 |
void send_resp(object ob, int cookie, mixed result) | 发送带cookie的消息返回 |
FSendCache.gs
发送缓存
函数原型 | 函数作用 |
---|---|
bool is_use_cache() | 是否使用发送缓存 |
void set_cache(bool use_cache = false) | 设置缓存 |
int get_max_cache_size() | 获取最大合并发送缓存数 |
void set_max_cache_size(int max_cache_size = 10) | 设置最大合并发送缓存数 |
void add_send_data(string cmd, ...) | 添加发送数据到缓存队列 |
void try_send() | 尝试发送 |
net_server.gs
Session.gs
会话链接
函数原型 | 函数作用 |
---|---|
bool is_session() | 是否是session |
void set_port_recv_size(int recv_size) | 设置接收缓冲区大小 |
bool is_connected() | 会话是否连接 |
object unbind_connection() | 取消绑定连接 |
void bind_connection(object conn) | 绑定连接对象 |
object get_connection() | 获取连接对象 |
bool transfer_connection(object to) | 切换绑定连接对象 |
void disconnect() | 断开连接 |
bool auto_close() | 自动关闭会话 |
void close_in_seconds(int seconds) | 设置在多少秒内关闭会话 |
void send_raw(string cmd, ...) | 发送消息 |
void send_direct(string cmd, ...) | 直接发送消息 |
void send_response(string cmd, int cookie, ...) | 同步请求指令 |
void ping() | 发送ping |
void pong() | 发送pong |