ARSoft.Tools.Net
ARSoft.Tools.Net copied to clipboard
How to set timeout or stop resolving ?
I have a list of domain names i'm trying to get their SPF addresses using the ARSoft package, but some requests return a huge result because something went wrong with extracting those domains SPF addresses, what I want to do is skip those domains, but C# does not catch StackOverFlowException, here is my lines:
var resolver = new DnsStubResolver(new DnsClient(IPAddress.Parse("8.8.8.8"), 3000));
List<TxtRecord> records = new List<TxtRecord>();
try {
records = resolver.Resolve<TxtRecord>(array[0].ToString(), RecordType.Txt);
} catch(StackOverflowException ex) {
return;
}
foreach (var record in records) { ... }
the "return" doesn't get executed because the app is blocked and the VS window is brought to front with the exception, any ideas ?
Found out there's a ResolveAsync method with CancellationToken parameter, I believe it can solve my problem, how to use it ?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.