#include <ZZDNet.h>
Public 成员函数 | |
| ZZDNet (const char *clientName, const char *netFile) | |
| 构造函数 | |
| virtual | ~ZZDNet () |
| 析构函数 | |
| void | setLocalNetwork (const char *ip, int port=0) |
| 本地网卡绑定 | |
| void | setUdpNetwork (const char *ip, int port) |
| 组播地址定义 | |
| const char * | clientName () |
| 客户端名称 | |
| int | start () |
| 启动连接 | |
| int | startDirectMode (const char *ip, int port) |
| 直连模式启动连接 | |
| void | stop () |
| 停止连接 | |
| ZZDNetRequest * | createRequest (const char *type) |
| 创建网络消息请求类型 | |
| void | registerRequest (const char *type, ZZDNetRequestCreatorFcn fcn) |
| 注册网络消息请求类型 | |
| void | unregisterRequest (const char *type) |
| 注销网络消息请求类型 | |
| bool | subscribeRequest (const char *type, ZZDNetUserDefineRequestCallback cb, void *usr) |
| 订购网络消息请求类型 | |
| bool | unsubscribeRequest (const char *type, ZZDNetUserDefineRequestCallback cb) |
| 取消订购网络消息请求类型 | |
| void | tick (long long interval=5) |
| 网络更新 | |
| ZZClientCore * | core () |
| 核心接口 | |
| void | enableLog (bool enable, bool print) |
| 日志接口 | |
静态 Public 成员函数 | |
| static bool | checkNetFile (const char *netFile) |
| 检查网络文件接口 | |
Protected 属性 | |
| ZZClientCore * | mCore |
| 核心对象接口 | |
| ZZDNet::ZZDNet | ( | const char * | clientName, |
| const char * | netFile ) |
构造函数
| clientName | 客户端名称 |
| netFile | 网络文件 |
|
virtual |
析构函数
|
static |
检查网络文件接口
| netFile | 网络文件 |
| const char * ZZDNet::clientName | ( | ) |
客户端名称
| ZZClientCore * ZZDNet::core | ( | ) |
核心接口
| ZZDNetRequest * ZZDNet::createRequest | ( | const char * | type | ) |
创建网络消息请求类型
| type | 网络消息请求类型 @desc 通过本地注册过的类型的网络消息请求示例化 |
| void ZZDNet::enableLog | ( | bool | enable, |
| bool | print ) |
日志接口
| enable | 启动或不启动 |
| 启动打印输出到显示或不启动 |
| void ZZDNet::registerRequest | ( | const char * | type, |
| ZZDNetRequestCreatorFcn | fcn ) |
注册网络消息请求类型
| type | 网络消息请求类型 |
| fcn | 网络消息请求创建函数 ZZDNetRequestCreatorFcn @desc 注册网络消息请求类,用户用于扩展 |
| void ZZDNet::setLocalNetwork | ( | const char * | ip, |
| int | port = 0 ) |
本地网卡绑定
| ip | 本地网卡IP制定 |
| port | 本地端口 |
| void ZZDNet::setUdpNetwork | ( | const char * | ip, |
| int | port ) |
组播地址定义
| ip | 组播地址 |
| port | 组播端口 |
| int ZZDNet::start | ( | ) |
启动连接
| int ZZDNet::startDirectMode | ( | const char * | ip, |
| int | port ) |
直连模式启动连接
| void ZZDNet::stop | ( | ) |
停止连接
| bool ZZDNet::subscribeRequest | ( | const char * | type, |
| ZZDNetUserDefineRequestCallback | cb, | ||
| void * | usr ) |
订购网络消息请求类型
| type | 网络消息请求类型 |
| cb | 网络消息请求回调函数定义 |
| usr | 网络消息请求回调用户定义指针 @desc 订购网络消息请求类, |
| void ZZDNet::tick | ( | long long | interval = 5 | ) |
网络更新
| interval | 更新间隔(单位:秒) @desc 网络更新函数,需要在循环中调用 |
| void ZZDNet::unregisterRequest | ( | const char * | type | ) |
注销网络消息请求类型
| type | 网络消息请求类型 @desc 注销网络消息请求类 |
| bool ZZDNet::unsubscribeRequest | ( | const char * | type, |
| ZZDNetUserDefineRequestCallback | cb ) |
取消订购网络消息请求类型
| type | 网络消息请求类型 |
| cb | 网络消息请求回调函数定义 @desc 取消订购网络消息请求类, |
|
protected |
核心对象接口