Esempio n. 1
0
        private void Form1_Shown(object sender, EventArgs e)
        {
            ThreadFeelDHT.Start(this);

            foreach (IPAddress ipaddress in Dns.GetHostByName(Dns.GetHostName()).AddressList)
            {
                cbTCP.Items.Add(ipaddress.ToString());  // Заполнение списка cbTCP адресами локального хоста.
            }
            cbTCP.SelectedIndex = 0;
            //Загрузка конфигурации из директории программы.
            bool isServerStart = false;

            System.Data.DataSet ds = new System.Data.DataSet();
            try
            {
                ds.ReadXmlSchema(Application.StartupPath + "\\UARTDHT.cfg");
                cbTCP.Text     = (string)ds.ExtendedProperties["tcp"];
                numPort.Value  = decimal.Parse((string)ds.ExtendedProperties["tcpPort"]);
                isServerStart  = Convert.ToBoolean(ds.ExtendedProperties["isServerStart"]);
                numTCrit.Value = decimal.Parse((string)ds.ExtendedProperties["tCrit"]);
                numHCrit.Value = decimal.Parse((string)ds.ExtendedProperties["hCrit"]);
            }
            catch { }
            if (isServerStart)
            {
                BlockStartServer();
                ThreadServer.Start(this, cbTCP.Text, (int)numPort.Value);
            }
        }
Esempio n. 2
0
 private void btnStartTCPListener_Click(object sender, EventArgs e)
 {
     BlockStartServer();
     ThreadServer.Start(this, cbTCP.Text, (int)numPort.Value);
 }