Dreamine.PLC.Omron.Fins 1.0.1
Dreamine.PLC.Omron.Fins 산업 자동화 및 I/O 기능을 제공합니다.
로딩중...
검색중...
일치하는것 없음
Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer 클래스 참조sealed

더 자세히 ...

Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer에 대한 상속 다이어그램 :
Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer에 대한 협력 다이어그램:

Public 멤버 함수

 OmronFinsUdpSimulatorServer (OmronFinsSimulatorServerOptions options)
 OmronFinsUdpSimulatorServer (OmronFinsSimulatorServerOptions options, InMemoryPlcMemory memory)
Task StartAsync ()
async Task StopAsync ()
async ValueTask DisposeAsync ()

속성

bool IsRunning [get]

이벤트

EventHandler< string >? StatusChanged

Private 멤버 함수

async Task ReceiveLoopAsync (CancellationToken cancellationToken)

정적 Private 멤버 함수

static IPAddress ParseAddress (string host)

Private 속성

readonly OmronFinsSimulatorServerOptions _options
readonly InMemoryPlcMemory _memory
readonly OmronFinsSimulatorProtocol _protocol
UdpClient? _udpClient
CancellationTokenSource? _cts
Task? _receiveTask

상세한 설명

로컬 및 PC 간 테스트를 위한 최소 FINS/UDP 시뮬레이터 서버를 제공합니다.

OmronFinsUdpSimulatorServer.cs 파일의 15 번째 라인에서 정의되었습니다.

생성자 & 소멸자 문서화

◆ OmronFinsUdpSimulatorServer() [1/2]

Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer.OmronFinsUdpSimulatorServer ( OmronFinsSimulatorServerOptions options)
inline

새 메모리를 사용해 T:Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer 클래스의 새 인스턴스를 초기화합니다.

매개변수
options바인딩 및 자동 응답 서버 옵션입니다.
예외
ArgumentNullExceptionoptionsnull일 때 발생합니다.

OmronFinsUdpSimulatorServer.cs 파일의 96 번째 라인에서 정의되었습니다.

97 : this(options, new InMemoryPlcMemory())
98 {
99 }

◆ OmronFinsUdpSimulatorServer() [2/2]

Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer.OmronFinsUdpSimulatorServer ( OmronFinsSimulatorServerOptions options,
InMemoryPlcMemory memory )
inline

지정한 공유 메모리를 사용해 T:Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer 클래스의 새 인스턴스를 초기화합니다.

매개변수
options바인딩 및 자동 응답 서버 옵션입니다.
memory요청 간에 공유할 PLC 메모리입니다.
예외
ArgumentNullExceptionoptions 또는 memorynull일 때 발생합니다.

OmronFinsUdpSimulatorServer.cs 파일의 133 번째 라인에서 정의되었습니다.

134 {
135 _options = options ?? throw new ArgumentNullException(nameof(options));
136 _memory = memory ?? throw new ArgumentNullException(nameof(memory));
137 _protocol = new OmronFinsSimulatorProtocol(_memory, _options);
138 _protocol.StatusChanged += (_, message) => StatusChanged?.Invoke(this, message);
139 }

다음을 참조함 : _memory, _options, _protocol, StatusChanged.

멤버 함수 문서화

◆ DisposeAsync()

async ValueTask Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer.DisposeAsync ( )
inline

서버를 중지해 비동기로 정리합니다.

반환값
비동기 정리 작업을 나타내는 값 작업입니다.

OmronFinsUdpSimulatorServer.cs 파일의 275 번째 라인에서 정의되었습니다.

276 {
277 await StopAsync().ConfigureAwait(false);
278 }

다음을 참조함 : StopAsync().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ ParseAddress()

IPAddress Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer.ParseAddress ( string host)
inlinestaticprivate

구성된 바인딩 호스트를 IP 주소로 변환하며 와일드카드와 잘못된 값은 모든 인터페이스로 처리합니다.

매개변수
host변환할 호스트 또는 와일드카드 문자열입니다.
반환값
구문 분석된 주소 또는 IPAddress.Any입니다.

OmronFinsUdpSimulatorServer.cs 파일의 304 번째 라인에서 정의되었습니다.

305 {
306 if (string.IsNullOrWhiteSpace(host) || host == "0.0.0.0" || host == "*" || host == "+")
307 {
308 return IPAddress.Any;
309 }
310
311 return IPAddress.TryParse(host, out var address) ? address : IPAddress.Any;
312 }

다음에 의해서 참조됨 : StartAsync().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ ReceiveLoopAsync()

async Task Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer.ReceiveLoopAsync ( CancellationToken cancellationToken)
inlineprivate

UDP 요청을 수신해 프로토콜로 처리하고 원격 끝점에 응답하는 루프를 실행합니다.

매개변수
cancellationToken수신 루프를 중지하는 토큰입니다.
반환값
수신 루프 수명 동안 실행되는 작업입니다.

OmronFinsUdpSimulatorServer.cs 파일의 338 번째 라인에서 정의되었습니다.

339 {
340 while (!cancellationToken.IsCancellationRequested && _udpClient is not null)
341 {
342 try
343 {
344 var request = await _udpClient.ReceiveAsync(cancellationToken).ConfigureAwait(false);
345 var response = _protocol.HandleRequest(request.Buffer);
346 await _udpClient.SendAsync(response, response.Length, request.RemoteEndPoint).ConfigureAwait(false);
347 }
348 catch (OperationCanceledException)
349 {
350 break;
351 }
352 catch (ObjectDisposedException)
353 {
354 break;
355 }
356 catch (SocketException ex)
357 {
358 StatusChanged?.Invoke(this, $"FINS UDP socket error: {ex.Message}");
359 }
360 catch (Exception ex)
361 {
362 StatusChanged?.Invoke(this, $"FINS UDP server error: {ex.Message}");
363 }
364 }
365 }

다음을 참조함 : _protocol, _udpClient, StatusChanged.

다음에 의해서 참조됨 : StartAsync().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ StartAsync()

Task Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer.StartAsync ( )
inline

구성된 주소와 포트에 UDP 소켓을 바인딩하고 수신 루프를 시작합니다.

반환값
서버가 이미 실행 중이거나 시작이 완료되면 완료되는 작업입니다.
예외
SocketException주소 또는 포트에 UDP 소켓을 바인딩할 수 없을 때 발생할 수 있습니다.
ArgumentOutOfRangeException구성된 포트가 유효한 범위를 벗어날 때 발생할 수 있습니다.

OmronFinsUdpSimulatorServer.cs 파일의 193 번째 라인에서 정의되었습니다.

194 {
195 if (IsRunning)
196 {
197 return Task.CompletedTask;
198 }
199
200 var address = ParseAddress(_options.Host);
201
202 _cts = new CancellationTokenSource();
203 _udpClient = new UdpClient(new IPEndPoint(address, _options.Port));
204 _receiveTask = ReceiveLoopAsync(_cts.Token);
205 StatusChanged?.Invoke(this, $"FINS UDP simulator listening on {_options.Host}:{_options.Port}.");
206 return Task.CompletedTask;
207 }

다음을 참조함 : _cts, _options, _receiveTask, _udpClient, IsRunning, ParseAddress(), ReceiveLoopAsync(), StatusChanged.

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ StopAsync()

async Task Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer.StopAsync ( )
inline

UDP 소켓과 수신 루프를 중지하고 서버 자원을 정리합니다.

반환값
수신 루프의 종료와 자원 정리를 나타내는 작업입니다.

OmronFinsUdpSimulatorServer.cs 파일의 225 번째 라인에서 정의되었습니다.

226 {
227 if (!IsRunning)
228 {
229 return;
230 }
231
232 _cts?.Cancel();
233 _udpClient?.Dispose();
234 _udpClient = null;
235
236 if (_receiveTask is not null)
237 {
238 try
239 {
240 await _receiveTask.ConfigureAwait(false);
241 }
242 catch (OperationCanceledException)
243 {
244 }
245 catch (ObjectDisposedException)
246 {
247 }
248 catch (SocketException)
249 {
250 }
251 }
252
253 _cts?.Dispose();
254 _cts = null;
255 _receiveTask = null;
256 StatusChanged?.Invoke(this, "FINS UDP simulator stopped.");
257 }

다음을 참조함 : _cts, _receiveTask, _udpClient, IsRunning, StatusChanged.

다음에 의해서 참조됨 : DisposeAsync().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

멤버 데이터 문서화

◆ _cts

CancellationTokenSource? Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer._cts
private

cts 값을 보관합니다.

OmronFinsUdpSimulatorServer.cs 파일의 61 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : StartAsync(), StopAsync().

◆ _memory

readonly InMemoryPlcMemory Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer._memory
private

memory 값을 보관합니다.

OmronFinsUdpSimulatorServer.cs 파일의 34 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : OmronFinsUdpSimulatorServer().

◆ _options

readonly OmronFinsSimulatorServerOptions Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer._options
private

options 값을 보관합니다.

OmronFinsUdpSimulatorServer.cs 파일의 25 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : OmronFinsUdpSimulatorServer(), StartAsync().

◆ _protocol

readonly OmronFinsSimulatorProtocol Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer._protocol
private

protocol 값을 보관합니다.

OmronFinsUdpSimulatorServer.cs 파일의 43 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : OmronFinsUdpSimulatorServer(), ReceiveLoopAsync().

◆ _receiveTask

Task? Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer._receiveTask
private

receive Task 값을 보관합니다.

OmronFinsUdpSimulatorServer.cs 파일의 70 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : StartAsync(), StopAsync().

◆ _udpClient

UdpClient? Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer._udpClient
private

udp Client 값을 보관합니다.

OmronFinsUdpSimulatorServer.cs 파일의 52 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : ReceiveLoopAsync(), StartAsync(), StopAsync().

속성 문서화

◆ IsRunning

bool Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer.IsRunning
get

UDP 소켓이 생성되어 서버가 실행 중인지 여부를 가져옵니다.

OmronFinsUdpSimulatorServer.cs 파일의 159 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : StartAsync(), StopAsync().

이벤트 문서화

◆ StatusChanged

EventHandler<string>? Dreamine.PLC.Omron.Fins.Simulation.OmronFinsUdpSimulatorServer.StatusChanged

서버 상태 또는 프로토콜 상태가 변경될 때 발생합니다.

OmronFinsUdpSimulatorServer.cs 파일의 149 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : OmronFinsUdpSimulatorServer(), ReceiveLoopAsync(), StartAsync(), StopAsync().


이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.: