示例#1
0
        public override void Connect()
        {
            try
            {
                foreach (IPAddress localIp in Dns.GetHostAddresses(Dns.GetHostName()).Where(i => i.AddressFamily == AddressFamily.InterNetwork))
                {
                    IPAddress ipToUse = localIp;

                    UdpClient client = new UdpClient(new IPEndPoint(ipToUse, this.LocalEndpoint.Port));
                    this.UdpClients.Add(client);
                    client.JoinMulticastGroup(IP, ipToUse);
                }
            }
            catch (SocketException)
            {
                throw new ConnectionErrorException(this.Host, this.Port);
            }

            KNXReceiver = new KNXReceiverRouting(this, this.UdpClients, LocalEndpoint);
            KNXReceiver.Start();

            KNXSender = new KNXSenderRouting(this, this.UdpClients, LocalEndpoint, RemoteEndpoint);

            base.Connected();
        }
示例#2
0
        public override void Connect()
        {
            try
            {

                foreach (IPAddress localIp in Dns.GetHostAddresses(Dns.GetHostName()).Where(i => i.AddressFamily == AddressFamily.InterNetwork))
                {
                    IPAddress ipToUse = localIp;

                    UdpClient client = new UdpClient(new IPEndPoint(ipToUse, this.LocalEndpoint.Port));
                    this.UdpClients.Add(client);
                    client.JoinMulticastGroup(IP, ipToUse);
                }
            }
            catch (SocketException)
            {
                throw new ConnectionErrorException(this.Host, this.Port);
            }

            KNXReceiver = new KNXReceiverRouting(this, this.UdpClients, LocalEndpoint);
            KNXReceiver.Start();

            KNXSender = new KNXSenderRouting(this, this.UdpClients, LocalEndpoint, RemoteEndpoint);

            base.Connected();
        }