Commit c5d359de authored by mercury233's avatar mercury233

resolve hostname

parent f6eae0a7
......@@ -46,7 +46,18 @@ namespace WindBot.Game
Connection.Connected += OnConnected;
Connection.PacketReceived += OnPacketReceived;
Connection.Connect(IPAddress.Parse(_serverHost), _serverPort);
IPAddress target_address;
try
{
target_address = IPAddress.Parse(_serverHost);
}
catch (System.Exception)
{
IPHostEntry _hostEntry = Dns.GetHostEntry(_serverHost);
target_address = _hostEntry.AddressList[0];
}
Connection.Connect(target_address, _serverPort);
}
private void OnConnected()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment