bloom.server.net
简介
组件接口
net.gs
函数原型 | 函数作用 |
---|---|
object start_server(string name, int port, bool ws, int client_heart = 0, array cmd_dirs = nil) | 启动服务器 |
void stop_server(string name) | 关闭服务器 |
void stop_all_servers() | 关闭所有服务器 |
object get_server(string name) | 通过名称获取服务器对象 |
void on_server_start(string name, function func) | 响应指定名称的服务器启动回调函数 |
void on_server_stop(string name, function func) | 响应指定名称的服务器停止回调函数 |
类
CircularQueue
循环队列,用来处理固定大小的缓冲区
成员变量
变量名 | 类型 | 初始值 | 须初始化 | 描述 |
---|---|---|---|---|
list | array | nil | 可选 | |
head | int | 0 | 可选 | |
tail | int | 0 | 可选 | |
size | int | 0 | 可选 |
成员方法
函数原型 | 函数作用 |
---|---|
bool is_queue_full() | 判断队列是否满 |
bool is_queue_empty() | 判断队列是否为空 |
int get_queue_size() | 获取队列大小 |
bool enqueue(mixed value) | 入队 |
mixed dequeue() | 出队 |
array dequeue_n(int count) | 出队n个 |
void drop_n(int count) | 丢弃n个 |
mixed peek(int offset = 0) | 获取队列头部元素(不删除) |
void resize(int size) | 调整队列大小 |
int next_index(int n, int size) |