GUdpSocket UDP socket.
更多...
#include <gUdpSocket.h>
继承自 GObject .
|
template<class Receiver , typename... Args> |
static int | connect (GObject *sender, GSignal< void(Args...)> &signal, Receiver *receiver, void(Receiver::*SlotFunc)(Args...)) |
| 将信号和槽建立连接。
Receiver代表接收者的类型 Args是槽函数/信号的参数列表。 更多...
|
|
template<class Receiver , typename... Args> |
static int | disconnect (GObject *sender, GSignal< void(Args...)> &signal, Receiver *receiver, void(Receiver::*SlotFunc)(Args...)) |
| 将信号和槽断开连接。
Receiver代表接收者的类型 Args是槽函数/信号的参数列表。 更多...
|
|
static bool | isObjectExist (GObject *obj) |
| 判断对象是否已经被析构掉了。 更多...
|
|
GUdpSocket::GUdpSocket |
( |
GObject * |
parent = 0 , |
|
|
const char * |
name = 0 |
|
) |
| |
|
explicit |
构造一个默认socket,未bind端口和地址
- 参数
-
virtual GUdpSocket::~GUdpSocket |
( |
| ) |
|
|
virtual |
int GUdpSocket::bind |
( |
const uint16_t |
hPort, |
|
|
const in_addr_t |
addr |
|
) |
| |
template<class Receiver , typename... Args>
int GObject::connect |
( |
GObject * |
sender, |
|
|
GSignal< void(Args...)> & |
signal, |
|
|
Receiver * |
receiver, |
|
|
void(Receiver::*)(Args...) |
SlotFunc |
|
) |
| |
|
staticinherited |
将信号和槽建立连接。
Receiver代表接收者的类型 Args是槽函数/信号的参数列表。
- 参数
-
sender | 指向发射者的指针 |
signal | 指向信号的引用。 |
receiver | 指向接收者的指针 |
SlotFunc | 指向槽函数的指针 |
- 返回
- 0代表成功;非0代表失败
template<class Receiver , typename... Args>
int GObject::disconnect |
( |
GObject * |
sender, |
|
|
GSignal< void(Args...)> & |
signal, |
|
|
Receiver * |
receiver, |
|
|
void(Receiver::*)(Args...) |
SlotFunc |
|
) |
| |
|
staticinherited |
将信号和槽断开连接。
Receiver代表接收者的类型 Args是槽函数/信号的参数列表。
- 参数
-
sender | 指向发射者的指针 |
signal | 指向信号的引用。 |
receiver | 指向接收者的指针 |
SlotFunc | 指向槽函数的指针 |
- 返回
- 0代表成功;非0代表失败
virtual bool GUdpSocket::event |
( |
GEvent * |
| ) |
|
|
virtual |
开发者可以在子类中覆盖此函数,处理自己需要的事件
- 参数
-
- 返回
- bool
重载 GObject .
static bool GObject::isObjectExist |
( |
GObject * |
obj | ) |
|
|
staticinherited |
判断对象是否已经被析构掉了。
- 参数
-
- 返回
- bool true表示对象健在,false表示对象已经被析构掉了
const char* GObject::name |
( |
| ) |
const |
|
inherited |
uint32_t GUdpSocket::recvBufferSize |
( |
| ) |
const |
返回接收缓冲区的大小,以字节为单位
- 返回
- uint32_t
int GUdpSocket::sendto |
( |
const char * |
pBuf, |
|
|
size_t |
length, |
|
|
int |
flags, |
|
|
sockaddr * |
dest_addr, |
|
|
socklen_t |
dest_len |
|
) |
| |
发送信息
- 参数
-
pBuf | ... |
length | ... |
flags | ... |
dest_addr | ... |
dest_len | ... |
- 返回
- int
void GUdpSocket::setRecvBufferSize |
( |
uint32_t |
bytes | ) |
|
设置接收缓冲区的大小,以字节为单位。默认情况下为2KB
- 参数
-
- 返回
- void
GSignal<void(char *buf, uint32_t len, const sockaddr_in &addr)> GUdpSocket::onReceived |
GSignal<void(void)> GObject::sigDestroyed |
|
inherited |
该类的文档由以下文件生成: