Quellcode durchsuchen

1.基础通信客户端,重连机制小小改动
2.版本更新

Shun vor 2 Jahren
Ursprung
Commit
d40b981793

+ 1 - 1
src/YSAI.DAQ/YSAI.Core/YSAI.Core.csproj

@@ -5,7 +5,7 @@
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
     <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
-    <Version>1.0.0.37</Version>
+    <Version>1.0.0.38</Version>
     <Authors>Shun</Authors>
     <Company>YSAI</Company>
     <Product>SCADA</Product>

+ 5 - 5
src/YSAI.DAQ/YSAI.Core/communication/net/tcp/client/TcpClientOperate.cs

@@ -156,11 +156,11 @@ namespace YSAI.Core.communication.net.tcp.client
                                 OnEventHandler(this, new EventResult(false, $"[{ClassName}]断线重连失败,连接超时,重连{ReconnectionCount}次"));  //数据传递出去
                                 ReconnectionCount++;
                             }
-                            else
-                            {
-                                OnEventHandler(this, new EventResult(true, $"[{ClassName}]断线重连成功"));  //数据传递出去
-                                ReconnectionCount = 1;
-                            }
+                        }
+                        if (ReconnectionCount > 1)
+                        {
+                            OnEventHandler(this, new EventResult(true, $"[{ClassName}]断线重连成功"));  //数据传递出去
+                            ReconnectionCount = 1;
                         }
                     }
                     catch (Exception ex)

+ 5 - 5
src/YSAI.DAQ/YSAI.Core/communication/net/ws/client/WsClientOperate.cs

@@ -146,11 +146,11 @@ namespace YSAI.Core.communication.net.ws.client
                                 OnEventHandler(this, new EventResult(false, $"[{ClassName}]断线重连失败,连接超时,重连{ReconnectionCount}次"));  //数据传递出去
                                 ReconnectionCount++;
                             }
-                            else
-                            {
-                                OnEventHandler(this, new EventResult(true, $"[{ClassName}]断线重连成功"));  //数据传递出去
-                                ReconnectionCount = 1;
-                            }
+                        }
+                        if (ReconnectionCount > 1)
+                        {
+                            OnEventHandler(this, new EventResult(true, $"[{ClassName}]断线重连成功"));  //数据传递出去
+                            ReconnectionCount = 1;
                         }
                     }
                     catch (Exception ex)