private async Task StartS7CommunicationSetup() { using (var dgmem = S7CommSetupDatagram.TranslateToMemory(S7CommSetupDatagram.Build(_s7Context, GetNextReferenceId()), out var commemLength)) { using (var sendData = _transport.Build(dgmem.Memory.Slice(0, commemLength), out var sendLength)) { var result = await _transport.Client.SendAsync(sendData.Memory.Slice(0, sendLength)).ConfigureAwait(false); if (result == SocketError.Success) { await UpdateConnectionState(ConnectionState.PendingOpenPlc).ConfigureAwait(false); } } } }
private async Task StartCommunicationSetup() { var sendData = DataTransferDatagram .TranslateToMemory( DataTransferDatagram .Build(_context, S7CommSetupDatagram .TranslateToMemory( S7CommSetupDatagram .Build(_s7Context))) .FirstOrDefault()); var result = await _socket.SendAsync(sendData); if (result == SocketError.Success) { UpdateConnectionState(ConnectionState.PendingOpenPlc); } }