1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-19 08:36:34 +09:00

Fix for ResolveAsync throwing host not found exception

This commit is contained in:
lidgren
2011-10-03 05:17:53 +00:00
parent 5fc175677f
commit b2380e895d

View File

@@ -41,8 +41,15 @@ namespace Lidgren.Network
public static void ResolveAsync(string ipOrHost, int port, ResolveEndPointCallback callback)
{
ResolveAsync(ipOrHost, delegate(IPAddress adr)
{
if (adr == null)
{
callback(null);
}
else
{
callback(new IPEndPoint(adr, port));
}
});
}
@@ -81,8 +88,24 @@ namespace Lidgren.Network
try
{
Dns.BeginGetHostEntry(ipOrHost, delegate(IAsyncResult result)
{
try
{
entry = Dns.EndGetHostEntry(result);
}
catch (SocketException ex)
{
if (ex.SocketErrorCode == SocketError.HostNotFound)
{
//LogWrite(string.Format(CultureInfo.InvariantCulture, "Failed to resolve host '{0}'.", ipOrHost));
callback(null);
return;
}
else
{
throw;
}
}
if (entry == null)
{