private static void ResolveCallback(object context)
{
ResolveAsyncResult result = (ResolveAsyncResult)context;
IPHostEntry hostEntry;
try
{
if (result.address != null)
{
hostEntry = InternalGetHostByAddress(result.address, result.includeIPv6);
}
else
{
hostEntry = InternalGetHostByName(result.hostName, result.includeIPv6);
}
}
catch (OutOfMemoryException)
{
throw;
}
catch (Exception exception)
{
result.InvokeCallback(exception);
return;
}
result.InvokeCallback(hostEntry);
}