Example #1
0
        public KnxConnectionConfiguration(string host, int port)
        {
            Host = host;
            Port = port;

            IpAddress = null;
            try
            {
                IpAddress = IPAddress.Parse(host);
            }
            catch
            {
                try
                {
                    IpAddress = DnsM.GetHostAddress(host);
                }
                catch (Exception)
                {
                    throw new InvalidHostException(host);
                }
            }

            if (IpAddress == null)
            {
                throw new InvalidHostException(host);
            }

            EndPoint = new IPEndPoint(IpAddress, port);
        }