|
@@ -257,7 +257,10 @@ namespace GWSocketClient
|
257
|
257
|
private void addToListboxItem(object info)
|
258
|
258
|
{
|
259
|
259
|
if (listBoxShow.Items.Count > 1000)
|
260
|
|
- listBoxShow.Items.Clear();
|
|
260
|
+ {
|
|
261
|
+ listBoxShow.Items.Remove(0);
|
|
262
|
+// listBoxShow.Items.Clear();
|
|
263
|
+ }
|
261
|
264
|
|
262
|
265
|
Console.WriteLine(info);
|
263
|
266
|
listBoxShow.Items.Add(info);
|
|
@@ -306,13 +309,14 @@ namespace GWSocketClient
|
306
|
309
|
/// </summary>
|
307
|
310
|
private void btnPressureTest_Click(object sender, EventArgs e)
|
308
|
311
|
{
|
309
|
|
-
|
310
|
312
|
ip = tbIpaddress.Text.Trim();
|
311
|
313
|
port = tbPort.Text.Trim();
|
312
|
314
|
|
|
315
|
+ int count = int.Parse(tbPresureTestCount.Text);
|
|
316
|
+
|
313
|
317
|
ThreadPool.QueueUserWorkItem(o =>
|
314
|
318
|
{
|
315
|
|
- for (int i = 1024; i < 1024 + 100; i++)
|
|
319
|
+ for (int i = 1024; i < 1024 + count; i++)
|
316
|
320
|
{
|
317
|
321
|
SocketHelper.TcpClients clientx = new SocketHelper.TcpClients(); //初始化类库
|
318
|
322
|
clientx.InitSocket(ip, int.Parse(port));
|
|
@@ -323,8 +327,32 @@ namespace GWSocketClient
|
323
|
327
|
loginCmd += "820014383938363032423131393135353034373938" + i;
|
324
|
328
|
loginCmd = Utils.calcCrcCode(loginCmd);
|
325
|
329
|
sockeTcpClients.SendData(HexUtil.hexToBytes(loginCmd));
|
|
330
|
+ Thread.Sleep(200);
|
326
|
331
|
}
|
327
|
332
|
});
|
328
|
333
|
}
|
|
334
|
+
|
|
335
|
+ private void listBoxShow_DoubleClick(object sender, EventArgs e)
|
|
336
|
+ {
|
|
337
|
+ int index = listBoxShow.SelectedIndex;
|
|
338
|
+ if (index >= 0 && index < listBoxShow.Items.Count)
|
|
339
|
+ {
|
|
340
|
+ string info = listBoxShow.SelectedItem.ToString();
|
|
341
|
+ if (!info.Equals(""))
|
|
342
|
+ {
|
|
343
|
+ if (info.Contains("[") || info.Contains("]"))
|
|
344
|
+ {
|
|
345
|
+ Regex reg = new Regex(@"\[\w+\]"); //注意里面的引号 要用双引号表示,而不是用反斜
|
|
346
|
+ Match match = reg.Match(info);
|
|
347
|
+ string ifs = match.ToString();
|
|
348
|
+ ifs = ifs.Replace("[", "").Replace("]", "");
|
|
349
|
+ if (!info.Equals(""))
|
|
350
|
+ {
|
|
351
|
+ MessageBox.Show(ifs);
|
|
352
|
+ }
|
|
353
|
+ }
|
|
354
|
+ }
|
|
355
|
+ }
|
|
356
|
+ }
|
329
|
357
|
}
|
330
|
358
|
}
|