📄 asyncudpsocket.h
字号:
#ifndef UTILS_BASE_ASYNCUDPSOCKET_H_#define UTILS_BASE_ASYNCUDPSOCKET_H_#include "asyncpacketsocket.h"#include "socketfactory.h"namespace utils_base {// Provides the ability to receive packets asynchronously. Sends are not// buffered since it is acceptable to drop packets under high load.class AsyncUDPSocket : public AsyncPacketSocket {public: AsyncUDPSocket(AsyncSocket* socket); virtual ~AsyncUDPSocket();private: char* buf_; size_t size_; // Called when the underlying socket is ready to be read from. void OnReadEvent(AsyncSocket* socket);};// Creates a new socket for sending asynchronous UDP packets using an// asynchronous socket from the given factory.inline AsyncUDPSocket* CreateAsyncUDPSocket(SocketFactory* factory) { return new AsyncUDPSocket(factory->CreateAsyncSocket(SOCK_DGRAM));}} // namespace utils_base#endif // UTILS_BASE_ASYNCUDPSOCKET_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -