dl
dl_net.h
浏览该文件的文档.
1
12#pragma once
13
14#include <asio.hpp>
15
16#include "io/dl_log.h"
17
18namespace dl
19{
21{
22public:
24 {
25 Debug();
26 }
30 static std::string GetHostName()
31 {
32 return asio::ip::host_name();
33 }
37 //static std::string GetIpAddress()
38 //{
39 // asio::io_context io;
40 // asio::ip::udp::resolver r{ io };
41 // asio::query q{ udp::v4(), "google.com", "" };
42
43 //}
44
45 void Debug()
46 {
47 log_msg("----------------网络信息-------------\n"
48 "主机名:\n{}"
49 "",
50 GetHostName());
51 }
52};
53
54extern Network* g_net;
55}
void Debug()
返回本机ip
Definition: dl_net.h:45
Network()
Definition: dl_net.h:23
static std::string GetHostName()
返回主机名
Definition: dl_net.h:30
日志系统
#define log_msg(...)
Definition: dl_log.h:193
Definition: dl_array2.h:18
Network * g_net