用epoll监听单个句柄 更多...
#include <sttnet.h>
Public 成员函数 | |
| void | startListen (const int &fd, const bool &flag=true, const time::Duration &dt=time::Duration{0, 0, 20, 0, 0}) |
| 开始监听 更多... | |
| bool | isListen () |
| 返回epoll监听状态 更多... | |
| void | setFunction (std::function< bool(const int &fd)> fc) |
| 设置epoll触发后的处理函数 注册一个回调函数 更多... | |
| void | setEndFunction (std::function< void(const int &fd)> fcEnd) |
| 设置epoll退出前的回调函数 注册一个回调函数 更多... | |
| void | setTimeOutFunction (std::function< bool(const int &fd)> fcTimeOut) |
| 设置epoll超时后出发的回调函数 注册一个回调函数 更多... | |
| bool | endListen () |
| 结束epoll监听 会阻塞直到epoll退出完成 更多... | |
| void | endListenWithSignal () |
| 发送结束epoll的信号 更多... | |
| void | waitAndQuit (const time::Duration &t=time::Duration{0, 0, 0, 10, 10}) |
| 开始退出epoll倒计时,直到套接字有新的消息 如果套接字倒计时结束还没有新的消息,那么退出epoll 更多... | |
| ~EpollSingle () | |
| EpollSingle的析构函数 调用eldListen阻塞退出epoll. 更多... | |
用epoll监听单个句柄
|
inline |
EpollSingle的析构函数 调用eldListen阻塞退出epoll.
| bool stt::network::EpollSingle::endListen | ( | ) |
结束epoll监听 会阻塞直到epoll退出完成
|
inline |
发送结束epoll的信号
|
inline |
返回epoll监听状态
|
inline |
设置epoll退出前的回调函数 注册一个回调函数
| fcEnd | 一个函数或函数对象,用于处理epoll退出前的流程 -参数:const int &fd - 要处理的套接字 |
|
inline |
设置epoll触发后的处理函数 注册一个回调函数
| fc | 一个函数或函数对象,用于当有数据时上来的时候回调处理套接字fd -参数:const int &fd - 要处理的套接字 -返回: bool - 返回true成功成功,返回false处理失败 |
|
inline |
设置epoll超时后出发的回调函数 注册一个回调函数
| fc | 一个函数或函数对象,用于当epoll超时的时候回调处理套接字fd -参数:const int &fd - 要处理的套接字 -返回: bool - 返回true成功成功,返回false处理失败 |
| void stt::network::EpollSingle::startListen | ( | const int & | fd, |
| const bool & | flag = true, |
||
| const time::Duration & | dt = time::Duration{0, 0, 20, 0, 0} |
||
| ) |
开始监听
| fd | 需要监听的句柄 |
| flag | true:水平触发 false:边缘触发 |
| dt | 填入监听超时时间 |
|
inline |
开始退出epoll倒计时,直到套接字有新的消息 如果套接字倒计时结束还没有新的消息,那么退出epoll
| t | 一个Duration对象 填入倒计时时长 (默认为10秒) |
1.8.5