Esempio n. 1
0
        [Test] public void LocalIP()
        {
            IPAddress[] addresses = LocalIPAddresses.AllAddresses();

            Assert.IsTrue(addresses != null, "No IP addresses returned");
            Assert.IsTrue(addresses.Length > 0, "No IP addresses found");
        }
Esempio n. 2
0
        public ConfigForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            txtPort.Text = Port.ToString();

            // Populate list of IP addresses
            IPAddress[] localAddresses = LocalIPAddresses.AllAddresses();
            if (localAddresses != null)
            {
                foreach (IPAddress ip in localAddresses)
                {
                    comInterfaces.Items.Add(ip);
                    if (ip == SpecificIP)
                    {
                        comInterfaces.SelectedItem = ip;
                    }
                }

                if (comInterfaces.SelectedItem == null && (comInterfaces.Items.Count > 0))
                {
                    comInterfaces.SelectedItem = comInterfaces.Items[0];
                }
            }

            radListenAll.Checked      = (SpecificIP == null);
            radListenSpecific.Checked = !radListenAll.Checked;

            UpdateGUI();
        }