Browse Source

添加发送->回复时间

张泳健 7 years ago
parent
commit
d3e766345b

+ 23 - 14
GWSocketClient/Form1.Designer.cs View File

59
             this.AddrToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
59
             this.AddrToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
60
             this.CCIDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
60
             this.CCIDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
61
             this.SendToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
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
             this.心跳HToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
64
             this.心跳HToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
63
             this.StripMenuItemLoSucHb = new System.Windows.Forms.ToolStripMenuItem();
65
             this.StripMenuItemLoSucHb = new System.Windows.Forms.ToolStripMenuItem();
64
             this.ToolStripMenuItemHbStart = new System.Windows.Forms.ToolStripMenuItem();
66
             this.ToolStripMenuItemHbStart = new System.Windows.Forms.ToolStripMenuItem();
79
             this.rightMenuCopyCmd = new System.Windows.Forms.ToolStripMenuItem();
81
             this.rightMenuCopyCmd = new System.Windows.Forms.ToolStripMenuItem();
80
             this.rightMenuClearInfo = new System.Windows.Forms.ToolStripMenuItem();
82
             this.rightMenuClearInfo = new System.Windows.Forms.ToolStripMenuItem();
81
             this.timerHeartBeat = new System.Windows.Forms.Timer(this.components);
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
             this.groupBox1.SuspendLayout();
85
             this.groupBox1.SuspendLayout();
85
             this.menuStrip1.SuspendLayout();
86
             this.menuStrip1.SuspendLayout();
86
             this.statusStrip1.SuspendLayout();
87
             this.statusStrip1.SuspendLayout();
189
             this.tbCCID.Name = "tbCCID";
190
             this.tbCCID.Name = "tbCCID";
190
             this.tbCCID.Size = new System.Drawing.Size(402, 23);
191
             this.tbCCID.Size = new System.Drawing.Size(402, 23);
191
             this.tbCCID.TabIndex = 12;
192
             this.tbCCID.TabIndex = 12;
192
-            this.tbCCID.Text = "3839383630324231313931353530343739383737";
193
+            this.tbCCID.Text = "3839383630324731313931353530333339393137";
193
             this.tbCCID.TextChanged += new System.EventHandler(this.tbCCID_TextChanged);
194
             this.tbCCID.TextChanged += new System.EventHandler(this.tbCCID_TextChanged);
194
             // 
195
             // 
195
             // btnPressureTest
196
             // btnPressureTest
409
             this.SendToolStripMenuItem.Text = "发送记录";
410
             this.SendToolStripMenuItem.Text = "发送记录";
410
             this.SendToolStripMenuItem.Click += new System.EventHandler(this.SendToolStripMenuItem_Click);
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
             // 心跳HToolStripMenuItem
425
             // 心跳HToolStripMenuItem
413
             // 
426
             // 
414
             this.心跳HToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
427
             this.心跳HToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
477
             this.tsslEquipmentAddress,
490
             this.tsslEquipmentAddress,
478
             this.toolStripStatusLabel2,
491
             this.toolStripStatusLabel2,
479
             this.tsslCCIDLEN,
492
             this.tsslCCIDLEN,
480
-            this.toolStripStatusLabelHbShow});
493
+            this.toolStripStatusLabelHbShow,
494
+            this.toolStripStatusLabelSendTime});
481
             this.statusStrip1.Location = new System.Drawing.Point(0, 883);
495
             this.statusStrip1.Location = new System.Drawing.Point(0, 883);
482
             this.statusStrip1.Name = "statusStrip1";
496
             this.statusStrip1.Name = "statusStrip1";
483
             this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 16, 0);
497
             this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 16, 0);
576
             this.timerHeartBeat.Interval = 5000;
590
             this.timerHeartBeat.Interval = 5000;
577
             this.timerHeartBeat.Tick += new System.EventHandler(this.timerHeartBeat_Tick);
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
             // Form1
599
             // Form1
592
             // 
600
             // 
671
         private System.Windows.Forms.ToolStripMenuItem SendToolStripMenuItem;
679
         private System.Windows.Forms.ToolStripMenuItem SendToolStripMenuItem;
672
         private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
680
         private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
673
         private System.Windows.Forms.ToolStripMenuItem ClearAllAllToolStripMenuItem;
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 View File

37
 
37
 
38
         private ThreadFormDelegate uiDelegate;
38
         private ThreadFormDelegate uiDelegate;
39
 
39
 
40
+
41
+        //这个发送时间,不处理心跳时间
42
+        private bool sendCmd = false;
43
+
44
+        private DateTime sendCmdTime;
45
+
40
         #endregion
46
         #endregion
41
 
47
 
42
 
48
 
57
                             vcarecityProtocolBean.ProtocolStartSymbol;
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
             ip = tbIpaddress.Text.Trim();
68
             ip = tbIpaddress.Text.Trim();
63
             port = tbPort.Text.Trim();
69
             port = tbPort.Text.Trim();
64
 
70
 
97
                 if (!showTopForNoLoadXML())
103
                 if (!showTopForNoLoadXML())
98
                     return;
104
                     return;
99
 
105
 
106
+
107
+                SocketHelper.pushSockets = new SocketHelper.PushSockets(receiveData); //注册推送器
108
+                sockeTcpClients = new SocketHelper.TcpClients();
109
+                sendCmdTime = DateTime.Now;
110
+
100
                 ip = tbIpaddress.Text.Trim();
111
                 ip = tbIpaddress.Text.Trim();
101
                 port = tbPort.Text.Trim();
112
                 port = tbPort.Text.Trim();
102
 
113
 
151
 
162
 
152
                     AccessDbLoader.getInstance().addToHistory(AccessDbLoader.SEND_HIS, trim);
163
                     AccessDbLoader.getInstance().addToHistory(AccessDbLoader.SEND_HIS, trim);
153
                     addToListboxItem(string.Format("发送到服务端:[{0}]", trim));
164
                     addToListboxItem(string.Format("发送到服务端:[{0}]", trim));
165
+                    //记录发送时间
166
+                    sendCmdTime = DateTime.Now;
167
+                    sendCmd = true;
154
 
168
 
155
                     sockeTcpClients.SendData(ts);
169
                     sockeTcpClients.SendData(ts);
156
                 }
170
                 }
404
             int funcode = Utils.hexToTen(functionWord);
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
             if (funcode == 4)
431
             if (funcode == 4)
409
             {
432
             {

BIN
GWSocketClient/bin/Release/dbfile/ID_INFO.accdb View File