/// <summary>
 /// Асинхронный запуск прослушивания
 /// </summary>
 /// <param name="logTextBox">TextBox для вывода лога</param>
 /// <param name="ipTextBox">TextBox для вывода данных для коннекта</param>
 /// <param name="ip">IP адрес</param>
 /// <param name="port">Порт</param>
 public async static void StartListening(TextBox logTextBox, TextBox ipTextBox, string ip = "auto", int port = 11000)
 {
     var log_tb = new Progress <string>(text => logTextBox.Text = DateTime.Now + ": " + text + "\r\n" + logTextBox.Text);
     var ip_tb  = new Progress <string>(text => ipTextBox.Text += text);
     await Task.Factory.StartNew <bool>(
         () => AsynchronousSocketListener.StartListening(log_tb, ip_tb, ip, port), TaskCreationOptions.LongRunning);
 }
예제 #2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     cfg = ConfigManager.GetConfigData();
     AsynchronousSocketListener.StartListening(logTextBox, ipTextBox, cfg.IP, cfg.Port);
 }