private void metroButton1_Click(object sender, EventArgs e) { string f = HttpLinkServise.Get("http://127.0.0.1:8080/rnn/uis"); metroTextBox1.Text += f; //string mikey = PasswordKey.get_passwordkey(1, "20200422"); //string time = DateTime.Now.ToLocalTime().ToString(); //MysqlContentTool.Ins.ConnStr = "server=127.0.0.1;port=3306;user=root;password=1111111111a; database=uisrnns;"; //string sql = @"INSERT INTO `uisrnns`.`cnt_callbell`(`IP`, `Date`) VALUES (@ip,@time)"; //List<MySqlParameter> Paramter = new List<MySqlParameter>(); //Paramter.Add(new MySqlParameter("@ip", "1.1.1.1")); //Paramter.Add(new MySqlParameter("@time", time)); //int i = MysqlContentTool.Ins.ExecuteNonquery(sql, Paramter.ToArray()); //metroTextBox1.Text += i.ToString(); }
private static readonly object Lock = new object(); // 互斥锁,解决当while未执行完成时时钟周期到下一周期导致的异常情况。 private void timer1_Tick(object sender, EventArgs e) { lock (Lock) // 加上锁以防意外访问情况 BETA 意外时去除 { if (this.ling.Size() <= 0) { this.timer1.Enabled = false; } KeyValuePair <DateTime, string> ts = this.ling.Gethead(); for (DateTime tmp; DateTime.Compare((tmp = DateTime.Now.ToLocalTime()), ts.Key) >= 0; ts = this.ling.Gethead()) { if (DateTime.Compare(ts.Key.AddMinutes(5), tmp) < 0) { if (this.ling.Size() <= 0) { this.timer1.Enabled = false; break; } this.ling.pophead(); continue; } // 生成秘钥并且提交到数据库 string cpkey = PasswordKey.get_passwordkey(); MysqlContentTool.Ins.ConnStr = "server=127.0.0.1;port=3306;user=root;password=1111111111a; database=uisrnns;"; string sql = @"INSERT INTO `uisrnns`.`cnt_exclude`(`UKEY`, `Date`) VALUES (@ukey,@time)"; List <MySqlParameter> Paramter = new List <MySqlParameter>(); //Paramter.Add(new MySqlParameter("@ip", ts.Value)); Paramter.Add(new MySqlParameter("@time", ts.Key.ToString())); Paramter.Add(new MySqlParameter("@ukey", cpkey)); MysqlContentTool.Ins.ExecuteNonquery(sql, Paramter.ToArray()); HttpLinkServise.Get("http://127.0.0.1:8080/action/call", "?ip=" + @ts.Value + "&post=5554&key=" + cpkey + "&msg=call"); //UISRNN.setipdemo(); //new System.Threading.Thread(new System.Threading.ThreadStart(new Action(() => //{ // UISRNN.uisrnn(new List<int> { 1 }); //}))).Start(); this.ling.pophead(); // 删掉头 } } }
private void Button_Click_3(object sender, RoutedEventArgs e) { new Thread(new ThreadStart(new Action(() => { HttpLinkServise.Get("http://127.0.0.1:8080/action/uncall", "?ip=" + "192.168.123.160" + "&post=5554"); }))).Start(); new Thread(new ThreadStart(new Action(() => { HttpLinkServise.Get("http://127.0.0.1:8080/action/uncall", "?ip=" + "192.168.123.191" + "&post=5554"); }))).Start(); new Thread(new ThreadStart(new Action(() => { HttpLinkServise.Get("http://127.0.0.1:8080/action/uncall", "?ip=" + "192.168.123.192" + "&post=5554"); }))).Start(); new Thread(new ThreadStart(new Action(() => { HttpLinkServise.Get("http://127.0.0.1:8080/action/uncall", "?ip=" + "192.168.123.193" + "&post=5554"); }))).Start(); }
public static void uisrnn(List <int> callnum) { foreach (int cp in callnum) { if (!ips.ContainsKey(cp)) { continue; } try { HashSet <string> tmp = ips[cp]; foreach (string ip in tmp) { System.Threading.Thread.Sleep(1000 * 10); HttpLinkServise.Get("http://127.0.0.1:8080/action/audio", "?args=" + ip + "&post=5554"); System.Threading.Thread.Sleep(1000 * 30); HttpLinkServise.Get("http://127.0.0.1:8080/action/savefile", "?ips=" + ip + "&post=5554"); System.Threading.Thread.Sleep(1000 * 15); } HttpLinkServise.Get("http://127.0.0.1:8080/rnn/uis"); } catch { } } }