예제 #1
0
        public Network(NetworkSettings sett)
        {
            if (sett.address.AddressFamily != System.Net.Sockets.AddressFamily.InterNetwork)
                throw new ArgumentException("Address must be a IPv4 address");
            if (sett.netmask.AddressFamily != System.Net.Sockets.AddressFamily.InterNetwork)
                throw new ArgumentException("Netmask must be a IPv4 netmask");
            if (!IsValidNetmask(sett.netmask))
                throw new ArgumentException("Netmask is not a valid netmask");

            this.netmask = sett.netmask;
            this.address = ApplyNetmask(sett.address, sett.netmask);

            if (!IsValidIPv4Address(this.address))
                throw new ArgumentException("Address is not a valid IPv4 address");
        }
예제 #2
0
        public Network(NetworkSettings sett)
        {
            if (sett.address.AddressFamily != System.Net.Sockets.AddressFamily.InterNetwork)
            {
                throw new ArgumentException("Address must be a IPv4 address");
            }
            if (sett.netmask.AddressFamily != System.Net.Sockets.AddressFamily.InterNetwork)
            {
                throw new ArgumentException("Netmask must be a IPv4 netmask");
            }
            if (!IsValidNetmask(sett.netmask))
            {
                throw new ArgumentException("Netmask is not a valid netmask");
            }

            this.netmask = sett.netmask;
            this.address = ApplyNetmask(sett.address, sett.netmask);

            if (!IsValidIPv4Address(this.address))
            {
                throw new ArgumentException("Address is not a valid IPv4 address");
            }
        }