asyncudpsocket.h
来自「本人收集整理的一份c/c++跨平台网络库」· C头文件 代码 · 共 33 行
H
33 行
#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 + =
减小字号Ctrl + -
显示快捷键?