代码拉取完成,页面将自动刷新
#pragma once
/*
* anet asio defining header.
*/
#include <functional>
#include "asio.hpp"
#include <assert.h>
#include <string>
#include <stdarg.h>
#include <stdio.h>
#include <ctime>
#include <vector>
#if defined(WIN32)
#pragma warning(disable:4996)
#endif
namespace anet {
namespace tcp {
class CConnection;
// sleep ms.
#define sleepMS(x) std::this_thread::sleep_for(std::chrono::milliseconds(x))
// sleep us.
#define sleepUS(x) std::this_thread::sleep_for(std::chrono::microseconds(x))
// asio library define.
typedef asio::io_context asioIOContext;
typedef asio::ip::tcp::acceptor asioAcceptor;
typedef asio::ip::tcp::socket asioSocket;
typedef asio::ip::tcp::endpoint asioEndPoint;
// CConnection share pointer.
typedef std::shared_ptr<CConnection> connSharePtr;
// CConnection weak pointer.
typedef std::weak_ptr<CConnection> connWeakPtr;
// async_connect error callback.
typedef std::function<void(const char* ip, unsigned short port, int err)> connectErrCallback;
// write buffer max size;
static int gMaxWriteBuffLength = 10 * 1024;
// max read buffer size;
static int gMaxReadBuffLength = 10 * 1024;
// max packet size.
static int gMaxPacketSize = 10 * 1024;
// listen blog size
static int gMaxListenBlog = 128;
// set max packet size
inline void setMaxPacketSize(int maxPacketSize) {
if (maxPacketSize > 0) {
gMaxPacketSize = maxPacketSize;
}
}
// set max listen blog size
inline void setMaxListenBlogSize(int blogSize) {
if (blogSize > 0) {
gMaxListenBlog = blogSize;
}
}
// set reading buffer size
inline void setReadBufferSize(int readBufferSize) {
if (readBufferSize > 0) {
gMaxReadBuffLength = readBufferSize;
}
}
// set writing buffer size
inline void setWriteBufferSize(int writeBufferSize) {
if (writeBufferSize > 0) {
gMaxWriteBuffLength = writeBufferSize;
}
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。