19#define DL_NETWORK_DEBUG_INFO
56 return &
_list.front();
85 bool Connent(std::string_view ip, uint16_t port);
93 std::atomic_bool _bEnd;
96 static void _thread_run(
void*);
117 static void _thread_run(
void*);
125 void SetAddress(std::string_view ip, uint16_t port,
bool broadcast =
false);
127 void Send(std::string_view str)
138 std::atomic_bool _bEnd;
144 static void _thread_send(
void*);
145 static void _thread_recv(
void*);
154 void Start(std::string_view ip, uint16_t port);
169 static void _thread_run(
void*);
194 return vec.empty() ?
"127.0.0.1" : vec[0];
199 log_msg(
"----------------网络信息-------------\n"
207extern Network*
g_net;
void Send(BufferView buf)
bool Connent(std::string_view ip, uint16_t port)
void Send(BufferView buf)
void Send(std::string_view str)
void SetAddress(std::string_view ip, uint16_t port, bool broadcast=false)
static std::string GetIpAddressLocalFirst(bool ipv4=true)
返回第一个本地ip,失败返回127.0.0.1
static std::vector< std::string > GetIpAddressLocal(bool ipv4=true)
返回本地ip
static std::string GetHostName()
返回主机名
bool Accept(uint16_t port)
friend class ServerUdpImp
void Start(std::string_view ip, uint16_t port)
constexpr uint32_t NETWORK_MESSAGE_TAG
std::span< std::byte > BufferView
ListMultiThread< UdpMessage > UdpMessageList
std::vector< std::byte > Buffer
ListMultiThread< Buffer > BufferList
BufferView CreateBufferView(std::string_view str)
创建buffer视图
std::list< Buffer > _listTemp
std::list< Buffer > _list