|
|
@@ -103,6 +103,8 @@ namespace UAS_PLCDataReader.PublicMethod
|
|
|
|
|
|
private string port;
|
|
|
|
|
|
+ private int ResetCount = 0;
|
|
|
+
|
|
|
string decode = "";
|
|
|
string dename = "";
|
|
|
|
|
|
@@ -129,7 +131,7 @@ namespace UAS_PLCDataReader.PublicMethod
|
|
|
string str = "";
|
|
|
try
|
|
|
{
|
|
|
- if (!socket.Connected)
|
|
|
+ if (!socket.Connected || ResetCount == 5)
|
|
|
{
|
|
|
socket.Close();
|
|
|
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
|
|
@@ -153,6 +155,7 @@ namespace UAS_PLCDataReader.PublicMethod
|
|
|
{
|
|
|
returnvalue.Add(socket.RemoteEndPoint.ToString(), str);
|
|
|
}
|
|
|
+ ResetCount = ResetCount + 1;
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|