You've already forked lidgren-network-gen3
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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user