We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
code: if (!await ConnectAsync()) { return null; } Stopwatch stopwatch = Stopwatch.StartNew(); stopwatch.Start(); try { var cts = new CancellationTokenSource(1000 * 3); byte[] bytes = await _Plc.ReadBytesAsync(DataType.DataBlock, DB, start, length, cts.Token); stopwatch.Stop(); if (bytes == null || bytes.Length == 0) { _LogUtil.Error($"S7Plc error:{stopwatch.Elapsed.TotalMilliseconds},IP:{_Plc.IP},DB:{DB},start:{start},length:{length},MaxPDUSize:{_Plc.MaxPDUSize}"); } return bytes;
} catch (Exception ex) { stopwatch.Stop(); _LogUtil.Error($"S7Plc Exception:{stopwatch.Elapsed.TotalMilliseconds},IP:{_Plc.IP},DB:{DB},start:{start},length:{length},MaxPDUSize:{_Plc.MaxPDUSize}, ex:{ex.Message}"); } return null;
=============
byte[] bytes = await _Plc.ReadBytesAsync(DataType.DataBlock, DB, start, length, cts.Token); // sometimes here never return or throw exception,why?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
code:
if (!await ConnectAsync())
{
return null;
}
Stopwatch stopwatch = Stopwatch.StartNew();
stopwatch.Start();
try
{
var cts = new CancellationTokenSource(1000 * 3);
byte[] bytes = await _Plc.ReadBytesAsync(DataType.DataBlock, DB, start, length, cts.Token);
stopwatch.Stop();
if (bytes == null || bytes.Length == 0)
{
_LogUtil.Error($"S7Plc error:{stopwatch.Elapsed.TotalMilliseconds},IP:{_Plc.IP},DB:{DB},start:{start},length:{length},MaxPDUSize:{_Plc.MaxPDUSize}");
}
return bytes;
}
catch (Exception ex)
{
stopwatch.Stop();
_LogUtil.Error($"S7Plc Exception:{stopwatch.Elapsed.TotalMilliseconds},IP:{_Plc.IP},DB:{DB},start:{start},length:{length},MaxPDUSize:{_Plc.MaxPDUSize}, ex:{ex.Message}");
}
return null;
=============
byte[] bytes = await _Plc.ReadBytesAsync(DataType.DataBlock, DB, start, length, cts.Token); // sometimes here never return or throw exception,why?
The text was updated successfully, but these errors were encountered: