private void sendFDR_Click(object sender, EventArgs e) { try { IPAddress[] IPs = Dns.GetHostAddresses(BBMD_IP.Text); IPAddress IP; if (client.Transport is BacnetIpUdpProtocolTransport) { IP = IPs.First <IPAddress>(o => o.AddressFamily == AddressFamily.InterNetwork); } else { IP = IPs.First <IPAddress>(o => o.AddressFamily == AddressFamily.InterNetworkV6); } client.RegisterAsForeignDevice(IP.ToString(), 30, PortNumber()); Thread.Sleep(50); client.RemoteWhoIs(IP.ToString(), PortNumber()); SendWhois.Enabled = true; } catch { } }