GetExternalAddressAsync() public method

public GetExternalAddressAsync ( CancellationToken cancel_token ) : Task
cancel_token System.Threading.CancellationToken
return Task
コード例 #1
0
        public async Task <IEnumerable <INatDevice> > DiscoverAsync(CancellationToken cancel_token)
        {
            var devices = new List <NatPmpDevice>();

            foreach (var gateway in GetGatewayAddresses())
            {
                var dev = new NatPmpDevice(gateway);
                var external_address = await dev.GetExternalAddressAsync(cancel_token).ConfigureAwait(false);

                if (external_address != null)
                {
                    devices.Add(dev);
                }
            }
            return(devices);
        }
コード例 #2
0
 public async Task<IEnumerable<INatDevice>> DiscoverAsync(CancellationToken cancel_token)
 {
   var devices = new List<NatPmpDevice>();
   foreach (var gateway in GetGatewayAddresses()) {
     var dev = new NatPmpDevice(gateway);
     var external_address = await dev.GetExternalAddressAsync(cancel_token);
     if (external_address!=null) devices.Add(dev);
   }
   return devices;
 }