diff --git a/.gitignore b/.gitignore
index 05ec4f6..4690600 100644
--- a/.gitignore
+++ b/.gitignore
@@ -155,3 +155,4 @@ $RECYCLE.BIN/
# Mac desktop service store files
.DS_Store
/Modbus.Net/packages
+/Modbus.Net/.vs
diff --git a/Modbus.Net/Modbus.Net.Modbus/Properties/AssemblyInfo.cs b/Modbus.Net/Modbus.Net.Modbus/Properties/AssemblyInfo.cs
index 77358cf..3d81132 100644
--- a/Modbus.Net/Modbus.Net.Modbus/Properties/AssemblyInfo.cs
+++ b/Modbus.Net/Modbus.Net.Modbus/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.1.0")]
-[assembly: AssemblyFileVersion("1.1.0")]
+[assembly: AssemblyVersion("1.1.1")]
+[assembly: AssemblyFileVersion("1.1.1")]
diff --git a/Modbus.Net/Modbus.Net.Siemens/Properties/AssemblyInfo.cs b/Modbus.Net/Modbus.Net.Siemens/Properties/AssemblyInfo.cs
index 80773a8..8950a30 100644
--- a/Modbus.Net/Modbus.Net.Siemens/Properties/AssemblyInfo.cs
+++ b/Modbus.Net/Modbus.Net.Siemens/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.1.0")]
-[assembly: AssemblyFileVersion("1.1.0")]
+[assembly: AssemblyVersion("1.1.1")]
+[assembly: AssemblyFileVersion("1.1.1")]
diff --git a/Modbus.Net/Modbus.Net/BaseMachine.cs b/Modbus.Net/Modbus.Net/BaseMachine.cs
index 69a6588..6a94354 100644
--- a/Modbus.Net/Modbus.Net/BaseMachine.cs
+++ b/Modbus.Net/Modbus.Net/BaseMachine.cs
@@ -22,6 +22,9 @@ namespace Modbus.Net
public abstract class BaseMachine : IMachineProperty
{
+ private int ErrorCount { get; set; } = 0;
+ private int _maxErrorCount = 3;
+
///
/// 设备的Id
///
@@ -186,11 +189,17 @@ namespace Modbus.Net
}
//返回数据
if (ans.Count == 0) ans = null;
+ ErrorCount = 0;
return ans;
}
catch (Exception e)
{
Console.WriteLine(ConnectionToken + " " + e.Message);
+ ErrorCount++;
+ if (ErrorCount >= _maxErrorCount)
+ {
+ Disconnect();
+ }
return null;
}
}
diff --git a/Modbus.Net/Modbus.Net/ModBus.Net.nuspec b/Modbus.Net/Modbus.Net/ModBus.Net.nuspec
index 63ec49f..63a0837 100644
--- a/Modbus.Net/Modbus.Net/ModBus.Net.nuspec
+++ b/Modbus.Net/Modbus.Net/ModBus.Net.nuspec
@@ -2,7 +2,7 @@
Modbus.Net
- 1.1.0
+ 1.1.1
Modbus.Net
Chris L.(Luo Sheng)
Hangzhou Delian Information and Science Technology Co.,Ltd.
diff --git a/Modbus.Net/Modbus.Net/Properties/AssemblyInfo.cs b/Modbus.Net/Modbus.Net/Properties/AssemblyInfo.cs
index e94cc1c..c9b0f81 100644
--- a/Modbus.Net/Modbus.Net/Properties/AssemblyInfo.cs
+++ b/Modbus.Net/Modbus.Net/Properties/AssemblyInfo.cs
@@ -35,5 +35,5 @@ using System.Runtime.InteropServices;
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.1.0")]
-[assembly: AssemblyFileVersion("1.1.0")]
\ No newline at end of file
+[assembly: AssemblyVersion("1.1.1")]
+[assembly: AssemblyFileVersion("1.1.1")]
\ No newline at end of file