浏览代码

添加发送->回复时间

张泳健 7 年前
父节点
当前提交
d3e766345b
共有 3 个文件被更改,包括 48 次插入16 次删除
  1. 23 14
      GWSocketClient/Form1.Designer.cs
  2. 25 2
      GWSocketClient/Form1.cs
  3. 二进制
      GWSocketClient/bin/Release/dbfile/ID_INFO.accdb

+ 23 - 14
GWSocketClient/Form1.Designer.cs 查看文件

@@ -59,6 +59,8 @@
59 59
             this.AddrToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
60 60
             this.CCIDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
61 61
             this.SendToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
62
+            this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
63
+            this.ClearAllAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
62 64
             this.心跳HToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
63 65
             this.StripMenuItemLoSucHb = new System.Windows.Forms.ToolStripMenuItem();
64 66
             this.ToolStripMenuItemHbStart = new System.Windows.Forms.ToolStripMenuItem();
@@ -79,8 +81,7 @@
79 81
             this.rightMenuCopyCmd = new System.Windows.Forms.ToolStripMenuItem();
80 82
             this.rightMenuClearInfo = new System.Windows.Forms.ToolStripMenuItem();
81 83
             this.timerHeartBeat = new System.Windows.Forms.Timer(this.components);
82
-            this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
83
-            this.ClearAllAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
84
+            this.toolStripStatusLabelSendTime = new System.Windows.Forms.ToolStripStatusLabel();
84 85
             this.groupBox1.SuspendLayout();
85 86
             this.menuStrip1.SuspendLayout();
86 87
             this.statusStrip1.SuspendLayout();
@@ -189,7 +190,7 @@
189 190
             this.tbCCID.Name = "tbCCID";
190 191
             this.tbCCID.Size = new System.Drawing.Size(402, 23);
191 192
             this.tbCCID.TabIndex = 12;
192
-            this.tbCCID.Text = "3839383630324231313931353530343739383737";
193
+            this.tbCCID.Text = "3839383630324731313931353530333339393137";
193 194
             this.tbCCID.TextChanged += new System.EventHandler(this.tbCCID_TextChanged);
194 195
             // 
195 196
             // btnPressureTest
@@ -409,6 +410,18 @@
409 410
             this.SendToolStripMenuItem.Text = "发送记录";
410 411
             this.SendToolStripMenuItem.Click += new System.EventHandler(this.SendToolStripMenuItem_Click);
411 412
             // 
413
+            // toolStripSeparator4
414
+            // 
415
+            this.toolStripSeparator4.Name = "toolStripSeparator4";
416
+            this.toolStripSeparator4.Size = new System.Drawing.Size(184, 6);
417
+            // 
418
+            // ClearAllAllToolStripMenuItem
419
+            // 
420
+            this.ClearAllAllToolStripMenuItem.Name = "ClearAllAllToolStripMenuItem";
421
+            this.ClearAllAllToolStripMenuItem.Size = new System.Drawing.Size(187, 22);
422
+            this.ClearAllAllToolStripMenuItem.Text = "清空所有记录";
423
+            this.ClearAllAllToolStripMenuItem.Click += new System.EventHandler(this.ClearAllAllToolStripMenuItem_Click);
424
+            // 
412 425
             // 心跳HToolStripMenuItem
413 426
             // 
414 427
             this.心跳HToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -477,7 +490,8 @@
477 490
             this.tsslEquipmentAddress,
478 491
             this.toolStripStatusLabel2,
479 492
             this.tsslCCIDLEN,
480
-            this.toolStripStatusLabelHbShow});
493
+            this.toolStripStatusLabelHbShow,
494
+            this.toolStripStatusLabelSendTime});
481 495
             this.statusStrip1.Location = new System.Drawing.Point(0, 883);
482 496
             this.statusStrip1.Name = "statusStrip1";
483 497
             this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 16, 0);
@@ -576,17 +590,11 @@
576 590
             this.timerHeartBeat.Interval = 5000;
577 591
             this.timerHeartBeat.Tick += new System.EventHandler(this.timerHeartBeat_Tick);
578 592
             // 
579
-            // toolStripSeparator4
580
-            // 
581
-            this.toolStripSeparator4.Name = "toolStripSeparator4";
582
-            this.toolStripSeparator4.Size = new System.Drawing.Size(184, 6);
593
+            // toolStripStatusLabelSendTime
583 594
             // 
584
-            // ClearAllAllToolStripMenuItem
585
-            // 
586
-            this.ClearAllAllToolStripMenuItem.Name = "ClearAllAllToolStripMenuItem";
587
-            this.ClearAllAllToolStripMenuItem.Size = new System.Drawing.Size(187, 22);
588
-            this.ClearAllAllToolStripMenuItem.Text = "清空所有记录";
589
-            this.ClearAllAllToolStripMenuItem.Click += new System.EventHandler(this.ClearAllAllToolStripMenuItem_Click);
595
+            this.toolStripStatusLabelSendTime.Name = "toolStripStatusLabelSendTime";
596
+            this.toolStripStatusLabelSendTime.Size = new System.Drawing.Size(85, 17);
597
+            this.toolStripStatusLabelSendTime.Text = "发送-回复时间";
590 598
             // 
591 599
             // Form1
592 600
             // 
@@ -671,6 +679,7 @@
671 679
         private System.Windows.Forms.ToolStripMenuItem SendToolStripMenuItem;
672 680
         private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
673 681
         private System.Windows.Forms.ToolStripMenuItem ClearAllAllToolStripMenuItem;
682
+        private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelSendTime;
674 683
     }
675 684
 }
676 685
 

+ 25 - 2
GWSocketClient/Form1.cs 查看文件

@@ -37,6 +37,12 @@ namespace GWSocketClient
37 37
 
38 38
         private ThreadFormDelegate uiDelegate;
39 39
 
40
+
41
+        //这个发送时间,不处理心跳时间
42
+        private bool sendCmd = false;
43
+
44
+        private DateTime sendCmdTime;
45
+
40 46
         #endregion
41 47
 
42 48
 
@@ -57,8 +63,8 @@ namespace GWSocketClient
57 63
                             vcarecityProtocolBean.ProtocolStartSymbol;
58 64
             }
59 65
 
60
-            SocketHelper.pushSockets = new SocketHelper.PushSockets(receiveData); //注册推送器
61
-            sockeTcpClients = new SocketHelper.TcpClients();
66
+//            SocketHelper.pushSockets = new SocketHelper.PushSockets(receiveData); //注册推送器
67
+//            sockeTcpClients = new SocketHelper.TcpClients();
62 68
             ip = tbIpaddress.Text.Trim();
63 69
             port = tbPort.Text.Trim();
64 70
 
@@ -97,6 +103,11 @@ namespace GWSocketClient
97 103
                 if (!showTopForNoLoadXML())
98 104
                     return;
99 105
 
106
+
107
+                SocketHelper.pushSockets = new SocketHelper.PushSockets(receiveData); //注册推送器
108
+                sockeTcpClients = new SocketHelper.TcpClients();
109
+                sendCmdTime = DateTime.Now;
110
+
100 111
                 ip = tbIpaddress.Text.Trim();
101 112
                 port = tbPort.Text.Trim();
102 113
 
@@ -151,6 +162,9 @@ namespace GWSocketClient
151 162
 
152 163
                     AccessDbLoader.getInstance().addToHistory(AccessDbLoader.SEND_HIS, trim);
153 164
                     addToListboxItem(string.Format("发送到服务端:[{0}]", trim));
165
+                    //记录发送时间
166
+                    sendCmdTime = DateTime.Now;
167
+                    sendCmd = true;
154 168
 
155 169
                     sockeTcpClients.SendData(ts);
156 170
                 }
@@ -404,6 +418,15 @@ namespace GWSocketClient
404 418
             int funcode = Utils.hexToTen(functionWord);
405 419
 
406 420
 
421
+           
422
+
423
+            if (sendCmd)
424
+            {
425
+                sendCmd = false;
426
+                long time = (long)(DateTime.Now - sendCmdTime).TotalMilliseconds;
427
+                toolStripStatusLabelSendTime.Text = "发送-回复时间: " + time + "/ms";
428
+            }
429
+            
407 430
             //处理心跳的回复
408 431
             if (funcode == 4)
409 432
             {

二进制
GWSocketClient/bin/Release/dbfile/ID_INFO.accdb 查看文件