public override async Task <bool> ConnectAsync() { _connectTryCount++; ProtocalLinker = _port == 0 ? new SiemensTcpProtocalLinker(_ip) : new SiemensTcpProtocalLinker(_ip, _port); if (!await ProtocalLinker.ConnectAsync()) { return(false); } _connectTryCount = 0; var inputStruct = new CreateReferenceSiemensInputStruct(_tdpuSize, _taspSrc, _tsapDst); return (await await ForceSendReceiveAsync(this[typeof(CreateReferenceSiemensProtocal)], inputStruct) .ContinueWith(async answer => { if (!ProtocalLinker.IsConnected) { return false; } var inputStruct2 = new EstablishAssociationSiemensInputStruct(0x0101, _maxCalling, _maxCalled, _maxPdu); var outputStruct2 = (EstablishAssociationSiemensOutputStruct) await SendReceiveAsync(this[typeof(EstablishAssociationSiemensProtocal)], inputStruct2); return outputStruct2 != null; })); }
/// <summary> /// 连接 /// </summary> /// <returns>是否连接成功</returns> public override async Task <bool> ConnectAsync() { return(await ProtocalLinker.ConnectAsync()); }
/// <summary> /// 连接 /// </summary> /// <returns>是否连接成功</returns> public override bool Connect() { return(ProtocalLinker.Connect()); }