diff --git a/.vs/HighWayIot/v17/.suo b/.vs/HighWayIot/v17/.suo index bc81352..e182b5f 100644 Binary files a/.vs/HighWayIot/v17/.suo and b/.vs/HighWayIot/v17/.suo differ diff --git a/HighWayIot.TouchSocket/HighWayIot.TouchSocket.csproj b/HighWayIot.TouchSocket/HighWayIot.TouchSocket.csproj index 8de118c..2beada0 100644 --- a/HighWayIot.TouchSocket/HighWayIot.TouchSocket.csproj +++ b/HighWayIot.TouchSocket/HighWayIot.TouchSocket.csproj @@ -36,6 +36,7 @@ ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll + @@ -54,7 +55,7 @@ - + diff --git a/HighWayIot.TouchSocket/TcpClient.cs b/HighWayIot.TouchSocket/RFIDTcpClient.cs similarity index 94% rename from HighWayIot.TouchSocket/TcpClient.cs rename to HighWayIot.TouchSocket/RFIDTcpClient.cs index c35bb09..9a3b4c8 100644 --- a/HighWayIot.TouchSocket/TcpClient.cs +++ b/HighWayIot.TouchSocket/RFIDTcpClient.cs @@ -11,10 +11,9 @@ using TouchSocket.Sockets; namespace HighWayIot.TouchSocket { - public class TcpClient + public class RFIDTcpClient { - private static LogHelper logHelper = LogHelper.Instance; public bool State @@ -25,7 +24,7 @@ namespace HighWayIot.TouchSocket global::TouchSocket.Sockets.TcpClient client = new global::TouchSocket.Sockets.TcpClient(); - public bool ClientStart(string ip, string port) + public bool ClientStart(string clientIP, string clientPort, string serverIP, string serverPort) { try { @@ -61,7 +60,7 @@ namespace HighWayIot.TouchSocket }; client.Setup(new TouchSocketConfig()//载入配置 - .SetRemoteIPHost($"{ip}:{port}") + .SetRemoteIPHost($"{clientIP}:{clientPort}") .ConfigureContainer(a =>//容器的配置顺序应该在最前面 { a.AddConsoleLogger();//添加一个控制台日志注入(注意:在maui中控制台日志不可用) @@ -70,7 +69,7 @@ namespace HighWayIot.TouchSocket { //a.Add();//此处可以添加插件 })); - client.Connect();//启动 + client.Connect($"{serverIP}:{serverPort}");//启动 logHelper.Info("监听服务启动成功"); return true; } @@ -139,6 +138,5 @@ namespace HighWayIot.TouchSocket logHelper.Info($"输入格式错误!"); } } - } } diff --git a/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.dll b/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.dll index 34a453b..da0afc9 100644 Binary files a/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.dll and b/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.dll differ diff --git a/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.pdb b/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.pdb index 2e74317..fa267a3 100644 Binary files a/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.pdb and b/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.pdb differ diff --git a/HighWayIot.TouchSocket/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/HighWayIot.TouchSocket/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 169b858..e25cfb8 100644 Binary files a/HighWayIot.TouchSocket/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/HighWayIot.TouchSocket/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.AssemblyReference.cache b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.AssemblyReference.cache index 91c3f93..ed7b03b 100644 Binary files a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.AssemblyReference.cache and b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.AssemblyReference.cache differ diff --git a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.CoreCompileInputs.cache b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.CoreCompileInputs.cache index f6b7940..df1037e 100644 --- a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.CoreCompileInputs.cache +++ b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -23d15fd1b9a74cae28e799b73990ede6b8b2b47e +529351f342a8ba9c98ec790a05321d5270e3d850 diff --git a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.dll b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.dll index 34a453b..da0afc9 100644 Binary files a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.dll and b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.dll differ diff --git a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.pdb b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.pdb index 2e74317..fa267a3 100644 Binary files a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.pdb and b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.pdb differ diff --git a/RFIDSocket/App.config b/RFIDSocket/App.config index 51e362a..85b6ba2 100644 --- a/RFIDSocket/App.config +++ b/RFIDSocket/App.config @@ -1,8 +1,13 @@  - - - + + +
+ + + + + diff --git a/RFIDSocket/DataAnalysis.cs b/RFIDSocket/DataAnalysis.cs index 5a9678b..3d41893 100644 --- a/RFIDSocket/DataAnalysis.cs +++ b/RFIDSocket/DataAnalysis.cs @@ -3,6 +3,8 @@ using HighWayIot.Repository.service.Impl; using HighWayIot.TouchSocket; using System; using System.Collections.Generic; +using System.Collections.Specialized; +using System.Configuration; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -57,24 +59,13 @@ namespace RFIDSocket foreach (var a in HeartBeatGroup) { var b = a.LastOrDefault(); - if (DateTime.Now - b.BeatTime > TimeSpan.FromSeconds(10)) + if (DateTime.Now - b.BeatTime < TimeSpan.FromSeconds(10)) { HeartbeatsState.Add(b); } } } - public List GetAllIP() - { - var groups = baseContentServiceImpl.GetContentInfos().GroupBy(x => x.IP); - List result = new List(); - foreach (var group in groups) - { - result.Add(group.Key); - } - return result; - } - private string SecondToTime(int t) { int m = t / 60; diff --git a/RFIDSocket/IPConfig.config b/RFIDSocket/IPConfig.config new file mode 100644 index 0000000..2f7bae8 --- /dev/null +++ b/RFIDSocket/IPConfig.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/RFIDSocket/RFIDSocket.Designer.cs b/RFIDSocket/RFIDSocket.Designer.cs index 6810727..daabc61 100644 --- a/RFIDSocket/RFIDSocket.Designer.cs +++ b/RFIDSocket/RFIDSocket.Designer.cs @@ -37,10 +37,10 @@ this.tipsDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.logTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.rFIDContentBindingSource = new System.Windows.Forms.BindingSource(this.components); - this.IPText = new System.Windows.Forms.TextBox(); + this.ClientIP = new System.Windows.Forms.TextBox(); this.SetAddress = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); - this.PortText = new System.Windows.Forms.TextBox(); + this.ClientPort = new System.Windows.Forms.TextBox(); this.MonitorOnOff = new System.Windows.Forms.Button(); this.label4 = new System.Windows.Forms.Label(); this.MonitorState = new System.Windows.Forms.Label(); @@ -73,9 +73,11 @@ this.MultiCount = new System.Windows.Forms.Label(); this.ShortCount = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); - this.MonitorAddress = new System.Windows.Forms.ComboBox(); + this.ServerIP = new System.Windows.Forms.ComboBox(); this.label12 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); + this.ServerPort = new System.Windows.Forms.TextBox(); + this.label15 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.CotentData)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.rFIDContentBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit(); @@ -97,14 +99,14 @@ this.tipsDataGridViewTextBoxColumn, this.logTimeDataGridViewTextBoxColumn}); this.CotentData.DataSource = this.rFIDContentBindingSource; - this.CotentData.Location = new System.Drawing.Point(12, 129); - this.CotentData.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.CotentData.Location = new System.Drawing.Point(9, 103); + this.CotentData.Margin = new System.Windows.Forms.Padding(2); this.CotentData.Name = "CotentData"; this.CotentData.RowHeadersVisible = false; this.CotentData.RowHeadersWidth = 51; this.CotentData.RowTemplate.Height = 17; this.CotentData.ScrollBars = System.Windows.Forms.ScrollBars.None; - this.CotentData.Size = new System.Drawing.Size(911, 1088); + this.CotentData.Size = new System.Drawing.Size(683, 870); this.CotentData.TabIndex = 0; // // sNDataGridViewTextBoxColumn @@ -159,22 +161,22 @@ // this.rFIDContentBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDContent); // - // IPText + // ClientIP // - this.IPText.Location = new System.Drawing.Point(152, 28); - this.IPText.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.IPText.MaxLength = 6; - this.IPText.Name = "IPText"; - this.IPText.Size = new System.Drawing.Size(129, 25); - this.IPText.TabIndex = 7; - this.IPText.Text = "127.0.0.1"; + this.ClientIP.Location = new System.Drawing.Point(114, 22); + this.ClientIP.Margin = new System.Windows.Forms.Padding(2); + this.ClientIP.MaxLength = 6; + this.ClientIP.Name = "ClientIP"; + this.ClientIP.Size = new System.Drawing.Size(98, 21); + this.ClientIP.TabIndex = 7; + this.ClientIP.Text = "127.0.0.1"; // // SetAddress // - this.SetAddress.Location = new System.Drawing.Point(353, 11); - this.SetAddress.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.SetAddress.Location = new System.Drawing.Point(265, 9); + this.SetAddress.Margin = new System.Windows.Forms.Padding(2); this.SetAddress.Name = "SetAddress"; - this.SetAddress.Size = new System.Drawing.Size(160, 56); + this.SetAddress.Size = new System.Drawing.Size(120, 45); this.SetAddress.TabIndex = 6; this.SetAddress.Text = "确认客户端地址"; this.SetAddress.UseVisualStyleBackColor = true; @@ -183,28 +185,29 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 33); + this.label1.Location = new System.Drawing.Point(9, 26); + this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(128, 15); + this.label1.Size = new System.Drawing.Size(101, 12); this.label1.TabIndex = 1; this.label1.Text = "客户端IP:端口号"; // - // PortText + // ClientPort // - this.PortText.Location = new System.Drawing.Point(288, 28); - this.PortText.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.PortText.MaxLength = 6; - this.PortText.Name = "PortText"; - this.PortText.Size = new System.Drawing.Size(59, 25); - this.PortText.TabIndex = 0; - this.PortText.Text = "1234"; + this.ClientPort.Location = new System.Drawing.Point(216, 22); + this.ClientPort.Margin = new System.Windows.Forms.Padding(2); + this.ClientPort.MaxLength = 6; + this.ClientPort.Name = "ClientPort"; + this.ClientPort.Size = new System.Drawing.Size(45, 21); + this.ClientPort.TabIndex = 0; + this.ClientPort.Text = "1234"; // // MonitorOnOff // - this.MonitorOnOff.Location = new System.Drawing.Point(928, 13); - this.MonitorOnOff.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.MonitorOnOff.Location = new System.Drawing.Point(696, 10); + this.MonitorOnOff.Margin = new System.Windows.Forms.Padding(2); this.MonitorOnOff.Name = "MonitorOnOff"; - this.MonitorOnOff.Size = new System.Drawing.Size(111, 50); + this.MonitorOnOff.Size = new System.Drawing.Size(83, 40); this.MonitorOnOff.TabIndex = 7; this.MonitorOnOff.Text = "启动监听"; this.MonitorOnOff.UseVisualStyleBackColor = true; @@ -213,9 +216,10 @@ // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(1055, 28); + this.label4.Location = new System.Drawing.Point(791, 22); + this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(82, 15); + this.label4.Size = new System.Drawing.Size(65, 12); this.label4.TabIndex = 8; this.label4.Text = "监听状态:"; // @@ -223,23 +227,25 @@ // this.MonitorState.AutoSize = true; this.MonitorState.BackColor = System.Drawing.Color.Transparent; - this.MonitorState.Location = new System.Drawing.Point(1147, 28); + this.MonitorState.Location = new System.Drawing.Point(860, 22); + this.MonitorState.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.MonitorState.Name = "MonitorState"; - this.MonitorState.Size = new System.Drawing.Size(22, 15); + this.MonitorState.Size = new System.Drawing.Size(17, 12); this.MonitorState.TabIndex = 9; this.MonitorState.Text = "关"; // // TableTimer // + this.TableTimer.Enabled = true; this.TableTimer.Interval = 1000; this.TableTimer.Tick += new System.EventHandler(this.TableTimer_Tick); // // PgUp // - this.PgUp.Location = new System.Drawing.Point(12, 74); - this.PgUp.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.PgUp.Location = new System.Drawing.Point(9, 59); + this.PgUp.Margin = new System.Windows.Forms.Padding(2); this.PgUp.Name = "PgUp"; - this.PgUp.Size = new System.Drawing.Size(135, 50); + this.PgUp.Size = new System.Drawing.Size(101, 40); this.PgUp.TabIndex = 8; this.PgUp.Text = "上一页"; this.PgUp.UseVisualStyleBackColor = true; @@ -247,10 +253,10 @@ // // PgDn // - this.PgDn.Location = new System.Drawing.Point(788, 74); - this.PgDn.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.PgDn.Location = new System.Drawing.Point(591, 59); + this.PgDn.Margin = new System.Windows.Forms.Padding(2); this.PgDn.Name = "PgDn"; - this.PgDn.Size = new System.Drawing.Size(135, 50); + this.PgDn.Size = new System.Drawing.Size(101, 40); this.PgDn.TabIndex = 13; this.PgDn.Text = "下一页"; this.PgDn.UseVisualStyleBackColor = true; @@ -261,9 +267,10 @@ this.PageRange.AutoSize = true; this.PageRange.BackColor = System.Drawing.Color.Transparent; this.PageRange.Font = new System.Drawing.Font("宋体", 12F); - this.PageRange.Location = new System.Drawing.Point(441, 88); + this.PageRange.Location = new System.Drawing.Point(331, 70); + this.PageRange.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.PageRange.Name = "PageRange"; - this.PageRange.Size = new System.Drawing.Size(69, 20); + this.PageRange.Size = new System.Drawing.Size(55, 16); this.PageRange.TabIndex = 15; this.PageRange.Text = "1 - 50"; // @@ -271,18 +278,19 @@ // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("宋体", 12F); - this.label3.Location = new System.Drawing.Point(349, 88); + this.label3.Location = new System.Drawing.Point(262, 70); + this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(109, 20); + this.label3.Size = new System.Drawing.Size(87, 16); this.label3.TabIndex = 14; this.label3.Text = "显示条数:"; // // LogStart // - this.LogStart.Location = new System.Drawing.Point(994, 101); - this.LogStart.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.LogStart.Location = new System.Drawing.Point(746, 81); + this.LogStart.Margin = new System.Windows.Forms.Padding(2); this.LogStart.Name = "LogStart"; - this.LogStart.Size = new System.Drawing.Size(113, 50); + this.LogStart.Size = new System.Drawing.Size(85, 40); this.LogStart.TabIndex = 16; this.LogStart.Text = "日志查询"; this.LogStart.UseVisualStyleBackColor = true; @@ -292,9 +300,10 @@ // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("宋体", 12F); - this.label2.Location = new System.Drawing.Point(1048, 206); + this.label2.Location = new System.Drawing.Point(786, 165); + this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(89, 20); + this.label2.Size = new System.Drawing.Size(71, 16); this.label2.TabIndex = 17; this.label2.Text = "连接状态"; // @@ -302,9 +311,10 @@ // this.label6.AutoSize = true; this.label6.Font = new System.Drawing.Font("宋体", 12F); - this.label6.Location = new System.Drawing.Point(1048, 436); + this.label6.Location = new System.Drawing.Point(786, 349); + this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(69, 20); + this.label6.Size = new System.Drawing.Size(55, 16); this.label6.TabIndex = 21; this.label6.Text = "总数量"; // @@ -312,9 +322,10 @@ // this.label7.AutoSize = true; this.label7.Font = new System.Drawing.Font("宋体", 12F); - this.label7.Location = new System.Drawing.Point(1048, 551); + this.label7.Location = new System.Drawing.Point(786, 441); + this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(89, 20); + this.label7.Size = new System.Drawing.Size(71, 16); this.label7.TabIndex = 23; this.label7.Text = "正常数量"; // @@ -322,18 +333,20 @@ // this.label8.AutoSize = true; this.label8.Font = new System.Drawing.Font("宋体", 12F); - this.label8.Location = new System.Drawing.Point(1048, 668); + this.label8.Location = new System.Drawing.Point(786, 534); + this.label8.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(89, 20); + this.label8.Size = new System.Drawing.Size(71, 16); this.label8.TabIndex = 25; this.label8.Text = "异常数量"; // // pictureBox5 // this.pictureBox5.Image = global::RFIDSocket.Properties.Resources.WarningCount; - this.pictureBox5.Location = new System.Drawing.Point(979, 669); + this.pictureBox5.Location = new System.Drawing.Point(734, 535); + this.pictureBox5.Margin = new System.Windows.Forms.Padding(2); this.pictureBox5.Name = "pictureBox5"; - this.pictureBox5.Size = new System.Drawing.Size(60, 60); + this.pictureBox5.Size = new System.Drawing.Size(45, 48); this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox5.TabIndex = 26; this.pictureBox5.TabStop = false; @@ -341,9 +354,10 @@ // pictureBox4 // this.pictureBox4.Image = global::RFIDSocket.Properties.Resources.NormalCount; - this.pictureBox4.Location = new System.Drawing.Point(979, 552); + this.pictureBox4.Location = new System.Drawing.Point(734, 442); + this.pictureBox4.Margin = new System.Windows.Forms.Padding(2); this.pictureBox4.Name = "pictureBox4"; - this.pictureBox4.Size = new System.Drawing.Size(60, 60); + this.pictureBox4.Size = new System.Drawing.Size(45, 48); this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox4.TabIndex = 24; this.pictureBox4.TabStop = false; @@ -351,9 +365,10 @@ // pictureBox3 // this.pictureBox3.Image = global::RFIDSocket.Properties.Resources.TotalCount; - this.pictureBox3.Location = new System.Drawing.Point(979, 437); + this.pictureBox3.Location = new System.Drawing.Point(734, 350); + this.pictureBox3.Margin = new System.Windows.Forms.Padding(2); this.pictureBox3.Name = "pictureBox3"; - this.pictureBox3.Size = new System.Drawing.Size(60, 60); + this.pictureBox3.Size = new System.Drawing.Size(45, 48); this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox3.TabIndex = 22; this.pictureBox3.TabStop = false; @@ -361,9 +376,10 @@ // DevicePictureBox // this.DevicePictureBox.Image = global::RFIDSocket.Properties.Resources.RunNormal; - this.DevicePictureBox.Location = new System.Drawing.Point(979, 320); + this.DevicePictureBox.Location = new System.Drawing.Point(734, 256); + this.DevicePictureBox.Margin = new System.Windows.Forms.Padding(2); this.DevicePictureBox.Name = "DevicePictureBox"; - this.DevicePictureBox.Size = new System.Drawing.Size(60, 60); + this.DevicePictureBox.Size = new System.Drawing.Size(45, 48); this.DevicePictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.DevicePictureBox.TabIndex = 20; this.DevicePictureBox.TabStop = false; @@ -371,9 +387,10 @@ // ConnectPictureBox // this.ConnectPictureBox.Image = global::RFIDSocket.Properties.Resources.ConnectNormal; - this.ConnectPictureBox.Location = new System.Drawing.Point(979, 207); + this.ConnectPictureBox.Location = new System.Drawing.Point(734, 166); + this.ConnectPictureBox.Margin = new System.Windows.Forms.Padding(2); this.ConnectPictureBox.Name = "ConnectPictureBox"; - this.ConnectPictureBox.Size = new System.Drawing.Size(60, 60); + this.ConnectPictureBox.Size = new System.Drawing.Size(45, 48); this.ConnectPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.ConnectPictureBox.TabIndex = 18; this.ConnectPictureBox.TabStop = false; @@ -382,9 +399,10 @@ // this.label5.AutoSize = true; this.label5.Font = new System.Drawing.Font("宋体", 12F); - this.label5.Location = new System.Drawing.Point(1048, 320); + this.label5.Location = new System.Drawing.Point(786, 256); + this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(89, 20); + this.label5.Size = new System.Drawing.Size(71, 16); this.label5.TabIndex = 19; this.label5.Text = "设备状态"; // @@ -392,9 +410,10 @@ // this.ConnectState.AutoSize = true; this.ConnectState.Font = new System.Drawing.Font("宋体", 12F); - this.ConnectState.Location = new System.Drawing.Point(1049, 247); + this.ConnectState.Location = new System.Drawing.Point(787, 198); + this.ConnectState.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.ConnectState.Name = "ConnectState"; - this.ConnectState.Size = new System.Drawing.Size(39, 20); + this.ConnectState.Size = new System.Drawing.Size(31, 16); this.ConnectState.TabIndex = 27; this.ConnectState.Text = "NAN"; // @@ -402,9 +421,10 @@ // this.DeviceState.AutoSize = true; this.DeviceState.Font = new System.Drawing.Font("宋体", 12F); - this.DeviceState.Location = new System.Drawing.Point(1048, 360); + this.DeviceState.Location = new System.Drawing.Point(786, 288); + this.DeviceState.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.DeviceState.Name = "DeviceState"; - this.DeviceState.Size = new System.Drawing.Size(39, 20); + this.DeviceState.Size = new System.Drawing.Size(31, 16); this.DeviceState.TabIndex = 28; this.DeviceState.Text = "NAN"; // @@ -412,9 +432,10 @@ // this.TotalCount.AutoSize = true; this.TotalCount.Font = new System.Drawing.Font("宋体", 12F); - this.TotalCount.Location = new System.Drawing.Point(1049, 477); + this.TotalCount.Location = new System.Drawing.Point(787, 382); + this.TotalCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.TotalCount.Name = "TotalCount"; - this.TotalCount.Size = new System.Drawing.Size(39, 20); + this.TotalCount.Size = new System.Drawing.Size(31, 16); this.TotalCount.TabIndex = 29; this.TotalCount.Text = "NAN"; // @@ -422,9 +443,10 @@ // this.NormalCount.AutoSize = true; this.NormalCount.Font = new System.Drawing.Font("宋体", 12F); - this.NormalCount.Location = new System.Drawing.Point(1049, 592); + this.NormalCount.Location = new System.Drawing.Point(787, 474); + this.NormalCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.NormalCount.Name = "NormalCount"; - this.NormalCount.Size = new System.Drawing.Size(39, 20); + this.NormalCount.Size = new System.Drawing.Size(31, 16); this.NormalCount.TabIndex = 30; this.NormalCount.Text = "NAN"; // @@ -432,9 +454,10 @@ // this.WarningCount.AutoSize = true; this.WarningCount.Font = new System.Drawing.Font("宋体", 12F); - this.WarningCount.Location = new System.Drawing.Point(1049, 709); + this.WarningCount.Location = new System.Drawing.Point(787, 567); + this.WarningCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.WarningCount.Name = "WarningCount"; - this.WarningCount.Size = new System.Drawing.Size(39, 20); + this.WarningCount.Size = new System.Drawing.Size(31, 16); this.WarningCount.TabIndex = 31; this.WarningCount.Text = "NAN"; // @@ -442,9 +465,10 @@ // this.label9.AutoSize = true; this.label9.Font = new System.Drawing.Font("宋体", 12F); - this.label9.Location = new System.Drawing.Point(975, 772); + this.label9.Location = new System.Drawing.Point(731, 618); + this.label9.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(89, 20); + this.label9.Size = new System.Drawing.Size(71, 16); this.label9.TabIndex = 32; this.label9.Text = "未读取:"; // @@ -452,9 +476,10 @@ // this.label10.AutoSize = true; this.label10.Font = new System.Drawing.Font("宋体", 12F); - this.label10.Location = new System.Drawing.Point(975, 805); + this.label10.Location = new System.Drawing.Point(731, 644); + this.label10.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(109, 20); + this.label10.Size = new System.Drawing.Size(87, 16); this.label10.TabIndex = 33; this.label10.Text = "间距异常:"; // @@ -462,9 +487,10 @@ // this.label11.AutoSize = true; this.label11.Font = new System.Drawing.Font("宋体", 12F); - this.label11.Location = new System.Drawing.Point(975, 869); + this.label11.Location = new System.Drawing.Point(731, 695); + this.label11.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(89, 20); + this.label11.Size = new System.Drawing.Size(71, 16); this.label11.TabIndex = 34; this.label11.Text = "多标签:"; // @@ -472,9 +498,10 @@ // this.NoReadCount.AutoSize = true; this.NoReadCount.Font = new System.Drawing.Font("宋体", 12F); - this.NoReadCount.Location = new System.Drawing.Point(1090, 772); + this.NoReadCount.Location = new System.Drawing.Point(818, 618); + this.NoReadCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.NoReadCount.Name = "NoReadCount"; - this.NoReadCount.Size = new System.Drawing.Size(39, 20); + this.NoReadCount.Size = new System.Drawing.Size(31, 16); this.NoReadCount.TabIndex = 35; this.NoReadCount.Text = "NAN"; // @@ -482,9 +509,10 @@ // this.NearCount.AutoSize = true; this.NearCount.Font = new System.Drawing.Font("宋体", 12F); - this.NearCount.Location = new System.Drawing.Point(1090, 805); + this.NearCount.Location = new System.Drawing.Point(818, 644); + this.NearCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.NearCount.Name = "NearCount"; - this.NearCount.Size = new System.Drawing.Size(39, 20); + this.NearCount.Size = new System.Drawing.Size(31, 16); this.NearCount.TabIndex = 36; this.NearCount.Text = "NAN"; // @@ -492,9 +520,10 @@ // this.MultiCount.AutoSize = true; this.MultiCount.Font = new System.Drawing.Font("宋体", 12F); - this.MultiCount.Location = new System.Drawing.Point(1090, 869); + this.MultiCount.Location = new System.Drawing.Point(818, 695); + this.MultiCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.MultiCount.Name = "MultiCount"; - this.MultiCount.Size = new System.Drawing.Size(39, 20); + this.MultiCount.Size = new System.Drawing.Size(31, 16); this.MultiCount.TabIndex = 37; this.MultiCount.Text = "NAN"; // @@ -502,9 +531,10 @@ // this.ShortCount.AutoSize = true; this.ShortCount.Font = new System.Drawing.Font("宋体", 12F); - this.ShortCount.Location = new System.Drawing.Point(1090, 837); + this.ShortCount.Location = new System.Drawing.Point(818, 670); + this.ShortCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.ShortCount.Name = "ShortCount"; - this.ShortCount.Size = new System.Drawing.Size(39, 20); + this.ShortCount.Size = new System.Drawing.Size(31, 16); this.ShortCount.TabIndex = 39; this.ShortCount.Text = "NAN"; // @@ -512,26 +542,29 @@ // this.label13.AutoSize = true; this.label13.Font = new System.Drawing.Font("宋体", 12F); - this.label13.Location = new System.Drawing.Point(975, 837); + this.label13.Location = new System.Drawing.Point(731, 670); + this.label13.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(89, 20); + this.label13.Size = new System.Drawing.Size(71, 16); this.label13.TabIndex = 38; this.label13.Text = "包过短:"; // - // MonitorAddress + // ServerIP // - this.MonitorAddress.FormattingEnabled = true; - this.MonitorAddress.Location = new System.Drawing.Point(700, 28); - this.MonitorAddress.Name = "MonitorAddress"; - this.MonitorAddress.Size = new System.Drawing.Size(143, 23); - this.MonitorAddress.TabIndex = 40; + this.ServerIP.FormattingEnabled = true; + this.ServerIP.Location = new System.Drawing.Point(478, 22); + this.ServerIP.Margin = new System.Windows.Forms.Padding(2); + this.ServerIP.Name = "ServerIP"; + this.ServerIP.Size = new System.Drawing.Size(108, 20); + this.ServerIP.TabIndex = 40; // // label12 // this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(582, 32); + this.label12.Location = new System.Drawing.Point(389, 26); + this.label12.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(112, 15); + this.label12.Size = new System.Drawing.Size(89, 12); this.label12.TabIndex = 41; this.label12.Text = "选择监听地址:"; // @@ -539,20 +572,44 @@ // this.label14.AutoSize = true; this.label14.Font = new System.Drawing.Font("宋体", 12F); - this.label14.Location = new System.Drawing.Point(516, 88); + this.label14.Location = new System.Drawing.Point(387, 70); + this.label14.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(59, 20); + this.label14.Size = new System.Drawing.Size(47, 16); this.label14.TabIndex = 42; this.label14.Text = "共200"; // + // ServerPort + // + this.ServerPort.Location = new System.Drawing.Point(635, 22); + this.ServerPort.Margin = new System.Windows.Forms.Padding(2); + this.ServerPort.MaxLength = 6; + this.ServerPort.Name = "ServerPort"; + this.ServerPort.Size = new System.Drawing.Size(45, 21); + this.ServerPort.TabIndex = 43; + this.ServerPort.Text = "1234"; + // + // label15 + // + this.label15.AutoSize = true; + this.label15.BackColor = System.Drawing.Color.Transparent; + this.label15.Location = new System.Drawing.Point(590, 26); + this.label15.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(41, 12); + this.label15.TabIndex = 44; + this.label15.Text = "端口号"; + // // RFIDSocket // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1189, 1229); + this.ClientSize = new System.Drawing.Size(892, 983); + this.Controls.Add(this.label15); + this.Controls.Add(this.ServerPort); this.Controls.Add(this.label14); this.Controls.Add(this.label12); - this.Controls.Add(this.MonitorAddress); + this.Controls.Add(this.ServerIP); this.Controls.Add(this.ShortCount); this.Controls.Add(this.label13); this.Controls.Add(this.MultiCount); @@ -579,17 +636,17 @@ this.Controls.Add(this.LogStart); this.Controls.Add(this.PageRange); this.Controls.Add(this.label3); - this.Controls.Add(this.IPText); + this.Controls.Add(this.ClientIP); this.Controls.Add(this.PgDn); this.Controls.Add(this.SetAddress); this.Controls.Add(this.label1); this.Controls.Add(this.PgUp); - this.Controls.Add(this.PortText); + this.Controls.Add(this.ClientPort); this.Controls.Add(this.MonitorState); this.Controls.Add(this.label4); this.Controls.Add(this.MonitorOnOff); this.Controls.Add(this.CotentData); - this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Margin = new System.Windows.Forms.Padding(2); this.Name = "RFIDSocket"; this.Text = " 通道门监听"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RFIDSocket_FormClosing); @@ -610,12 +667,12 @@ private System.Windows.Forms.DataGridView CotentData; private System.Windows.Forms.Button SetAddress; private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox PortText; + private System.Windows.Forms.TextBox ClientPort; private System.Windows.Forms.Button MonitorOnOff; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label MonitorState; private System.Windows.Forms.Timer TableTimer; - private System.Windows.Forms.TextBox IPText; + private System.Windows.Forms.TextBox ClientIP; private System.Windows.Forms.Button PgUp; private System.Windows.Forms.Button PgDn; private System.Windows.Forms.Label PageRange; @@ -644,7 +701,7 @@ private System.Windows.Forms.Label MultiCount; private System.Windows.Forms.Label ShortCount; private System.Windows.Forms.Label label13; - private System.Windows.Forms.ComboBox MonitorAddress; + private System.Windows.Forms.ComboBox ServerIP; private System.Windows.Forms.Label label12; private System.Windows.Forms.BindingSource rFIDContentBindingSource; private System.Windows.Forms.DataGridViewTextBoxColumn sNDataGridViewTextBoxColumn; @@ -654,6 +711,8 @@ private System.Windows.Forms.DataGridViewTextBoxColumn tipsDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn logTimeDataGridViewTextBoxColumn; private System.Windows.Forms.Label label14; + private System.Windows.Forms.TextBox ServerPort; + private System.Windows.Forms.Label label15; } } diff --git a/RFIDSocket/RFIDSocket.cs b/RFIDSocket/RFIDSocket.cs index 9f5d2e0..6df5ffa 100644 --- a/RFIDSocket/RFIDSocket.cs +++ b/RFIDSocket/RFIDSocket.cs @@ -12,26 +12,22 @@ using System.Threading.Tasks; using System.Windows.Forms; using TouchSocket.Sockets; using static System.Windows.Forms.VisualStyles.VisualStyleElement; -using TcpClient = HighWayIot.TouchSocket.TcpClient; +using System.Configuration; namespace RFIDSocket { public partial class RFIDSocket : Form { - private static TcpClient Server = TcpClient.Instance; - private static DataAnalysis RFIDData = DataAnalysis.Instance; + private static ServerConnect ServerConnect = ServerConnect.Instance; - string Port = "1234"; - string IP = "127.0.0.1"; + string CPort = "1234"; + string CIP = "127.0.0.1"; int PageNo = 1; - List IPs = new List(); private List Content = new List(); - BindingSource bs = new BindingSource(); - public RFIDSocket() { InitializeComponent(); @@ -40,69 +36,76 @@ namespace RFIDSocket private void InitAction() { - if (!Server.State) + if (!ServerConnect.State) { MonitorState.Text = "关"; MonitorState.BackColor = Color.Yellow; } - else if (Server.State) + else if (ServerConnect.State) { MonitorState.Text = "开"; MonitorState.BackColor = Color.LightGreen; } - Port = PortText.Text; - IP = IPText.Text; - - IPs = RFIDData.GetAllIP(); + CPort = ClientPort.Text; + CIP = ClientIP.Text; - bs.DataSource = IPs; - MonitorAddress.DataSource = bs; + ServerIP.DataSource = ServerConnect.IPConfig.Keys.ToArray(); } private void MonitorOnOff_Click(object sender, EventArgs e) { - if (!Server.State) + if (!ServerConnect.State) { - if (Server.ClientStart(IP, Port)) + Dictionary results = ServerConnect.ConnectAllServer(ServerPort.Text, CIP, CPort); + bool flag = false; + foreach(var pair in results) { - MessageBox.Show("监听服务启动成功!"); - TableTimer.Enabled = true; + if (!pair.Value) + { + MessageBox.Show($"{pair.Key}连接启动失败!"); + flag = true; + } } - else + if (!flag) { - MessageBox.Show("监听服务启动失败!"); + MessageBox.Show("监听服务启动成功!"); } } - else if (Server.State) + else if (ServerConnect.State) { - if (Server.ClientStop()) + Dictionary results = ServerConnect.ConnectAllStop(); + bool flag = false; + foreach (var pair in results) { - MessageBox.Show("监听服务关闭成功!"); - TableTimer.Enabled = false; + if (!pair.Value) + { + MessageBox.Show($"{pair.Key}连接关闭失败!"); + flag = true; + } } - else + if (!flag) { - MessageBox.Show("监听服务关闭失败!"); + MessageBox.Show("监听服务关闭成功!"); } } } private void SetPort_Click(object sender, EventArgs e) { - Port = PortText.Text; - IP = IPText.Text; + CPort = ClientPort.Text; + CIP = ClientIP.Text; } private void TableTimer_Tick(object sender, EventArgs e) { - if (!Server.State) + if (!ServerConnect.State) { MonitorOnOff.Text = "启动监听"; MonitorState.Text = "关"; MonitorState.BackColor = Color.Yellow; } - else if (Server.State) + else if (ServerConnect.State) { MonitorOnOff.Text = "关闭监听"; MonitorState.Text = "开"; @@ -111,10 +114,6 @@ namespace RFIDSocket RFIDData.GetData(); - IPs = RFIDData.GetAllIP(); - bs.DataSource = IPs; - bs.ResetBindings(false); - CotentData.DataSource = null; switch (PageNo) { @@ -131,24 +130,46 @@ namespace RFIDSocket private void RFIDSocket_FormClosing(object sender, FormClosingEventArgs e) { - if (Server.State) + if (ServerConnect.State) { - if (!Server.ClientStop()) + Dictionary results = ServerConnect.ConnectAllStop(); + bool flag = false; + foreach (var pair in results) + { + if (!pair.Value) + { + flag = true; + } + } + if (flag) + { + if(MessageBox.Show("退出确认", "部分服务未能完全关闭!确认要退出?", MessageBoxButtons.OKCancel) == DialogResult.Cancel) + { + e.Cancel = true; + } + } + results = ServerConnect.ConnectAllDispose(); + flag = false; + foreach (var pair in results) { - MessageBox.Show("监听服务关闭失败! 请成功关闭后再退出"); - e.Cancel = true; + if (!pair.Value) + { + flag = true; + } } - if (!Server.ClientDispose()) + if (flag) { - MessageBox.Show("监听服务释放失败! 请再次尝试退出"); - e.Cancel = true; + if (MessageBox.Show("退出确认", "部分服务未能完全释放!确认要退出?", MessageBoxButtons.OKCancel) == DialogResult.Cancel) + { + e.Cancel = true; + } } } } private void StateRefresh() { - if (RFIDData.HeartbeatsState.Where(x => x.IP == MonitorAddress.Text.ToString()).Count() == 0) + if (RFIDData.HeartbeatsState.Where(x => x.IP == ServerConnect.IPConfig[ServerIP.Text].ToString()).Count() != 0) { ConnectPictureBox.Image = Properties.Resources.ConnectNormal; ConnectState.Text = "正常"; @@ -159,7 +180,7 @@ namespace RFIDSocket ConnectState.Text = "异常"; } - if (RFIDData.AlarmState.Where(x => x.IP == MonitorAddress.Text.ToString()).Count() == 0) + if (RFIDData.AlarmState.Where(x => x.IP == ServerConnect.IPConfig[ServerIP.Text].ToString()).Count() == 0) { DevicePictureBox.Image = Properties.Resources.ConnectNormal; DeviceState.Text = "正常"; @@ -181,7 +202,7 @@ namespace RFIDSocket private void ContentPages(int skip) { - Content = RFIDData.rFIDContents.Where(x => x.IP == MonitorAddress.Text.ToString()).Reverse().Take(200).ToList(); + Content = RFIDData.rFIDContents.Where(x => x.IP == ServerConnect.IPConfig[ServerIP.Text].ToString()).Reverse().Take(200).ToList(); CotentData.DataSource = Content.Skip(skip).Take(50).ToList(); } diff --git a/RFIDSocket/RFIDSocket.csproj b/RFIDSocket/RFIDSocket.csproj index db0ff92..8b8d9e8 100644 --- a/RFIDSocket/RFIDSocket.csproj +++ b/RFIDSocket/RFIDSocket.csproj @@ -37,6 +37,7 @@ ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll + @@ -71,6 +72,7 @@ + ResXFileCodeGenerator Resources.Designer.cs @@ -98,6 +100,9 @@ Settings.settings True + + Always + diff --git a/RFIDSocket/RFIDSocket.resx b/RFIDSocket/RFIDSocket.resx index 7d63d68..652a0e5 100644 --- a/RFIDSocket/RFIDSocket.resx +++ b/RFIDSocket/RFIDSocket.resx @@ -120,9 +120,6 @@ 199, 21 - - 199, 21 - 21, 21 diff --git a/RFIDSocket/ServerConnect.cs b/RFIDSocket/ServerConnect.cs new file mode 100644 index 0000000..29cc001 --- /dev/null +++ b/RFIDSocket/ServerConnect.cs @@ -0,0 +1,123 @@ +using HighWayIot.Repository.service.Impl; +using HighWayIot.TouchSocket; +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Configuration; +using System.Linq; +using System.Net.NetworkInformation; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; + +namespace RFIDSocket +{ + public class ServerConnect + { + private static readonly Lazy lazy = new Lazy(() => new ServerConnect()); + + public static ServerConnect Instance => lazy.Value; + + BaseContentServiceImpl baseContentServiceImpl => new BaseContentServiceImpl(); + + private static List TcpClients = new List(); + + /// + /// 获取配置键值对 + /// + public static Dictionary IPConfig + { + get + { + NameValueCollection config = ConfigurationManager.GetSection("IPConfigData") as NameValueCollection; + Dictionary result = new Dictionary(); + foreach (string key in config.AllKeys) + { + result.Add(key, config[key]); + } + return result; + } + + } + + public bool State = false; + + public static string[] IPs = IPConfig.Values.ToArray(); + public static string[] Names = IPConfig.Keys.ToArray(); + + public ServerConnect() + { + for(int i = 0; i < IPs.Length; i++) + { + TcpClients.Add(new RFIDTcpClient()); + } + } + + /// + /// 查找数据表里所有IP + /// + /// + public List GetAllIP() + { + var groups = baseContentServiceImpl.GetContentInfos().GroupBy(x => x.IP); + List result = new List(); + foreach (var group in groups) + { + result.Add(group.Key); + } + return result; + } + + /// + /// 连接所有服务端 + /// + /// + /// + /// + /// 成功与否结果 + public Dictionary ConnectAllServer(string serverPort, string clientIP, string clientPort) + { + int count = IPs.Length; + Dictionary results = new Dictionary(); + for (int i = 0; i < count; i++) + { + results.Add(Names[i], TcpClients[i].ClientStart(IPs[i], serverPort, clientIP, clientPort)); + } + State = true; + return results; + } + + /// + /// 暂停所有服务端 + /// + /// 成功与否结果 + public Dictionary ConnectAllStop() + { + int count = IPs.Length; + Dictionary results = new Dictionary(); + for (int i = 0; i < count; i++) + { + results.Add(Names[i], TcpClients[i].ClientStop()); + } + State = false; + return results; + } + + /// + /// 释放所有服务端 + /// + /// 成功与否结果 + public Dictionary ConnectAllDispose() + { + int count = IPs.Length; + Dictionary results = new Dictionary(); + for (int i = 0; i < count; i++) + { + results.Add(Names[i], TcpClients[i].ClientDispose()); + } + return results; + } + + } + +}