SampleSmart 1.0.0.0
SampleSmart 사용 방법을 보여 주는 예제 프로젝트입니다.
로딩중...
검색중...
일치하는것 없음
TcpLoopbackTestView.xaml.Event.cs
이 파일의 문서화 페이지로 가기
1using Dreamine.Communication.Core.Protocols;
2
4
13public sealed class TcpLoopbackTestViewEvent
14{
24
50 {
51 _runtime = runtime ?? throw new ArgumentNullException(nameof(runtime));
52
53 SelectedTcpLoopbackProtocol = "PlainText";
54 SelectedTcpLoopbackEncoding = PlainTextProtocolOptions.Utf8EncodingName;
55 TcpLoopbackSendText = "Hello from Dreamine TCP Loopback";
56 }
57
66 public IReadOnlyList<string> TcpLoopbackProtocols => _runtime.TcpProtocols;
67
76 public IReadOnlyList<string> TcpLoopbackEncodings => _runtime.TextEncodings;
77
86 public string SelectedTcpLoopbackProtocol { get; set; }
87
96 public string SelectedTcpLoopbackEncoding { get; set; }
97
106 public string TcpLoopbackSendText { get; set; }
107
116 public void StartLoopback()
117 {
118 _ = StartLoopbackAsync();
119 }
120
129 public void StopLoopback()
130 {
131 _ = _runtime.StopAllTcpAsync();
132 }
133
142 public void SendClient()
143 {
144 _ = _runtime.SendTcpClientAsync(
148 }
149
158 public void SendServer()
159 {
160 _ = _runtime.SendTcpServerAsync(
164 }
165
182 private async Task StartLoopbackAsync()
183 {
184 await _runtime.StartTcpServerAsync(
187
188 await _runtime.ConnectTcpClientAsync(
191 }
192}