Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void DnsResolve (string host, Action<IPAddress> callback)
- {
- IPAddress addr;
- if (!IPAddress.TryParse (host, out addr)) {
- Dns.BeginGetHostEntry (host, (a) => {
- Enqueue (delegate {
- try {
- IPHostEntry ep = Dns.EndGetHostEntry (a);
- callback (ep.AddressList[0]);
- } catch {
- }
- });
- }, null);
- } else {
- callback (addr);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement