コード例 #1
0
        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);
                    }
                }
            }
        }