Ejemplo n.º 1
0
        public static IPAddr GetLocalIPAddress(INDISFilter adapter)
        {
            IPAddr address = new IPAddr();

            NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();

            foreach (var adapt in nics)
            {
                // if this adapter matches the one we're looking for
                if (adapt.Id.Equals(adapter.GetAdapterInformation().Id))
                {
                    foreach (var i in adapt.GetIPProperties().UnicastAddresses)
                    {
                        if (i.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                        {
                            address = new IPAddr(i.Address.GetAddressBytes());
                            return(address);
                        }
                    }
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
 public IPObj(IPAddr addr)
 {
     this.Address = addr;
     time(DateTime.Now);
 }