2016-01-12 update 1

This commit is contained in:
parallelbgls@outlook.com
2016-01-12 15:29:35 +08:00
parent 2cbd5c1e4d
commit 3d67116006
2 changed files with 7 additions and 3 deletions

View File

@@ -37,7 +37,7 @@ namespace ModBus.Net.Siemens
public override async Task<byte[]> SendReceiveAsync(params object[] content)
{
while (!ProtocalLinker.IsConnected)
if (ProtocalLinker == null || !ProtocalLinker.IsConnected)
{
await ConnectAsync();
}
@@ -51,7 +51,7 @@ namespace ModBus.Net.Siemens
public override async Task<OutputStruct> SendReceiveAsync(ProtocalUnit unit, InputStruct content)
{
if (!ProtocalLinker.IsConnected)
if (ProtocalLinker == null || !ProtocalLinker.IsConnected)
{
if (connectTryCount > 10) return null;
return await await ConnectAsync().ContinueWith(answer => answer.Result ? base.SendReceiveAsync(unit, content) : null);