创建远程连接时打开域名解析

This commit is contained in:
大石头X2 2017-03-01 04:22:14 +08:00
parent b42f7c5ab3
commit 15ea0db358
1 changed files with 5 additions and 1 deletions

View File

@ -134,8 +134,12 @@ Socket* NetworkInterface::CreateRemote(const NetUri& uri)
auto socket = CreateSocket(uri.Type); auto socket = CreateSocket(uri.Type);
if (socket) if (socket)
{ {
// 域名解析
auto ip = QueryDNS(uri.Host);
if (ip == IPAddress::Any())ip = uri.Address;
socket->Local.Address = IP; socket->Local.Address = IP;
socket->Remote.Address = uri.Address; socket->Remote.Address = ip;
socket->Remote.Port = uri.Port; socket->Remote.Port = uri.Port;
socket->Server = uri.Host; socket->Server = uri.Host;
} }