|
Dreamine.Communication.Sockets 1.0.2
Dreamine.Communication.Sockets 통신 기능과 관련 API를 제공합니다.
|


클래스 | |
| class | TcpClientConnectionEntry |
Public 멤버 함수 | |
| TcpServerTransport (TcpServerTransportOptions options) | |
| TcpServerTransport (TcpServerTransportOptions options, IMessageProtocolAdapter protocolAdapter, IMessageFrameCodec frameCodec) | |
| Task | ConnectAsync (CancellationToken cancellationToken=default) |
| async Task | DisconnectAsync (CancellationToken cancellationToken=default) |
| Task | SendAsync (MessageEnvelope message, CancellationToken cancellationToken=default) |
| async Task | SendAsync (TcpServerSendTargetMode targetMode, MessageEnvelope message, CancellationToken cancellationToken=default) |
| Task | BroadcastAsync (MessageEnvelope message, CancellationToken cancellationToken=default) |
| async ValueTask | DisposeAsync () |
속성 | |
| ConnectionState | State [get] |
| TransportKind | Kind [get] |
| int | ConnectedClientCount [get] |
| TcpServerSendTargetMode | SendTargetMode [get, set] |
이벤트 | |
| EventHandler< MessageEnvelope >? | MessageReceived |
| EventHandler< int >? | ConnectedClientCountChanged |
Private 멤버 함수 | |
| TcpClientConnectionEntry[] | GetTargetClients (TcpServerSendTargetMode targetMode) |
| async Task | SendToClientAsync (TcpClientConnectionEntry target, byte[] payload, CancellationToken cancellationToken) |
| async Task | AcceptLoopAsync (CancellationToken cancellationToken) |
| async Task | ReceiveLoopAsync (Guid clientId, TcpClient client, CancellationToken cancellationToken) |
| void | CleanupListener () |
| void | CleanupClients () |
| void | RemoveClient (Guid clientId, TcpClient client) |
| void | SetState (ConnectionState state) |
| void | NotifyConnectedClientCountChanged () |
정적 Private 멤버 함수 | |
| static IPAddress | ParseHost (string host) |
| static void | ValidateOptions (TcpServerTransportOptions options) |
Private 속성 | |
| readonly TcpServerTransportOptions | _options |
| readonly IMessageProtocolAdapter | _protocolAdapter |
| readonly IMessageFrameCodec | _frameCodec |
| readonly ConcurrentDictionary< Guid, TcpClientConnectionEntry > | _clients = new() |
| TcpListener? | _listener |
| CancellationTokenSource? | _serverCts |
| Task? | _acceptLoopTask |
| int | _state = (int)ConnectionState.Disconnected |
여러 TCP 클라이언트의 연결, 수신 및 대상별 메시지 송신을 관리합니다.
여러 TCP 클라이언트의 연결, 수신 및 대상별 메시지 송신을 관리합니다.
TcpServerTransport.cs 파일의 31 번째 라인에서 정의되었습니다.
|
inline |
기본 Dreamine JSON 프로토콜과 길이 접두사 프레임으로 TCP 서버를 초기화합니다.
| options | 수신 주소, 대기열, 버퍼 및 송신 대상 설정입니다. |
TcpServerTransport.cs 파일의 123 번째 라인에서 정의되었습니다.
|
inline |
TCP 서버 설정과 사용자 지정 프로토콜 및 프레임 코덱으로 서버를 초기화합니다.
| options | 수신 주소, 대기열, 버퍼 및 송신 대상 설정입니다. |
| protocolAdapter | 메시지와 외부 페이로드를 변환할 어댑터입니다. |
| frameCodec | 클라이언트 스트림의 메시지 경계를 처리할 코덱입니다. |
| ArgumentNullException | options , protocolAdapter 또는 frameCodec 이 null인 경우 발생합니다. |
TcpServerTransport.cs 파일의 171 번째 라인에서 정의되었습니다.
다음을 참조함 : _frameCodec, _options, _protocolAdapter, ValidateOptions().

|
inlineprivate |
TCP 클라이언트를 계속 수락하고 각 연결의 수신 루프를 시작합니다.
| cancellationToken | 수락 루프 종료 토큰입니다. |
TcpServerTransport.cs 파일의 702 번째 라인에서 정의되었습니다.
다음을 참조함 : _clients, _listener, _options, CleanupClients(), CleanupListener(), NotifyConnectedClientCountChanged(), ReceiveLoopAsync(), SetState(), State.
다음에 의해서 참조됨 : ConnectAsync().


|
inline |
연결된 모든 TCP 클라이언트에게 메시지를 병렬 전송합니다.
| message | 브로드캐스트할 메시지입니다. |
| cancellationToken | 브로드캐스트 취소 토큰입니다. |
TcpServerTransport.cs 파일의 532 번째 라인에서 정의되었습니다.
다음을 참조함 : SendAsync().

|
inlineprivate |
현재 연결된 모든 클라이언트를 제거하고 해제합니다.
TcpServerTransport.cs 파일의 883 번째 라인에서 정의되었습니다.
다음을 참조함 : _clients, RemoveClient().
다음에 의해서 참조됨 : AcceptLoopAsync(), ConnectAsync(), DisconnectAsync().


|
inlineprivate |
정리 예외를 전파하지 않고 TCP Listener를 중지합니다.
TcpServerTransport.cs 파일의 861 번째 라인에서 정의되었습니다.
다음을 참조함 : _listener.
다음에 의해서 참조됨 : AcceptLoopAsync(), ConnectAsync(), DisconnectAsync().

|
inline |
TCP Listener를 시작하고 백그라운드 클라이언트 수락 루프를 실행합니다.
| cancellationToken | 서버 및 수락 루프 수명과 연결할 취소 토큰입니다. |
TcpServerTransport.cs 파일의 271 번째 라인에서 정의되었습니다.
다음을 참조함 : _acceptLoopTask, _listener, _options, _serverCts, AcceptLoopAsync(), CleanupClients(), CleanupListener(), ParseHost(), SetState(), State.

|
inline |
수락 루프와 Listener를 중지하고 연결된 모든 클라이언트를 해제합니다.
| cancellationToken | 정리 후 연결 해제 취소 여부를 확인하는 토큰입니다. |
TcpServerTransport.cs 파일의 338 번째 라인에서 정의되었습니다.
다음을 참조함 : _acceptLoopTask, _serverCts, CleanupClients(), CleanupListener(), SetState(), State.
다음에 의해서 참조됨 : DisposeAsync().


|
inline |
Listener, 수락 루프 및 클라이언트 연결을 비동기적으로 해제합니다.
TcpServerTransport.cs 파일의 595 번째 라인에서 정의되었습니다.
다음을 참조함 : DisconnectAsync().

|
inlineprivate |
연결 시각과 대상 정책에 따라 송신 대상 클라이언트 스냅샷을 생성합니다.
| targetMode | 적용할 대상 선택 정책입니다. |
TcpServerTransport.cs 파일의 564 번째 라인에서 정의되었습니다.
다음을 참조함 : Dreamine.Communication.Sockets.Enums.Broadcast, Dreamine.Communication.Sockets.Enums.FirstClient, Dreamine.Communication.Sockets.Enums.LastClient.
다음에 의해서 참조됨 : SendAsync().

|
inlineprivate |
현재 연결 클라이언트 수로 변경 이벤트를 발생시킵니다.
TcpServerTransport.cs 파일의 964 번째 라인에서 정의되었습니다.
다음을 참조함 : ConnectedClientCount, ConnectedClientCountChanged.
다음에 의해서 참조됨 : AcceptLoopAsync(), RemoveClient().

|
inlinestaticprivate |
서버 바인딩 호스트 문자열을 IPv4 주소로 변환합니다.
| host | 변환할 호스트 문자열입니다. |
| ArgumentException | 올바른 IP 주소가 아닌 경우 발생합니다. |
TcpServerTransport.cs 파일의 1001 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : ConnectAsync().

|
inlineprivate |
특정 클라이언트의 프레임을 계속 읽어 메시지 수신 이벤트를 발생시킵니다.
| clientId | 클라이언트 연결 식별자입니다. |
| client | 데이터를 읽을 TCP 클라이언트입니다. |
| cancellationToken | 수신 루프 종료 토큰입니다. |
TcpServerTransport.cs 파일의 809 번째 라인에서 정의되었습니다.
다음을 참조함 : _frameCodec, _protocolAdapter, MessageReceived, RemoveClient(), State.
다음에 의해서 참조됨 : AcceptLoopAsync().


|
inlineprivate |
연결 사전에서 클라이언트를 제거하고 소켓을 닫은 뒤 개수 변경을 알립니다.
| clientId | 제거할 연결 식별자입니다. |
| client | 닫고 해제할 TCP 클라이언트입니다. |
TcpServerTransport.cs 파일의 915 번째 라인에서 정의되었습니다.
다음을 참조함 : _clients, NotifyConnectedClientCountChanged().
다음에 의해서 참조됨 : CleanupClients(), ReceiveLoopAsync(), SendToClientAsync().


|
inline |
구성된 기본 대상 정책에 따라 연결된 클라이언트에게 메시지를 전송합니다.
| message | 전송할 메시지입니다. |
| cancellationToken | 송신 취소 요청을 감시하는 토큰입니다. |
TcpServerTransport.cs 파일의 410 번째 라인에서 정의되었습니다.
다음을 참조함 : SendAsync(), SendTargetMode.
다음에 의해서 참조됨 : BroadcastAsync(), SendAsync().


|
inline |
지정한 대상 정책으로 선택한 클라이언트들에게 메시지를 병렬 전송합니다.
| targetMode | 클라이언트 선택 정책입니다. |
| message | 전송할 메시지입니다. |
| cancellationToken | 모든 클라이언트 송신 취소 토큰입니다. |
| ArgumentNullException | 메시지가 null인 경우 발생합니다. |
| InvalidOperationException | 서버가 수신 대기 중이 아니거나 대상 클라이언트가 없는 경우 발생합니다. |
TcpServerTransport.cs 파일의 473 번째 라인에서 정의되었습니다.
다음을 참조함 : _protocolAdapter, GetTargetClients(), SendToClientAsync(), State.

|
inlineprivate |
클라이언트별 잠금을 사용해 한 클라이언트에 프레임을 순차적으로 전송합니다.
| target | 대상 클라이언트 연결 정보입니다. |
| payload | 프레임으로 전송할 프로토콜 페이로드입니다. |
| cancellationToken | 잠금 대기와 송신 취소 토큰입니다. |
TcpServerTransport.cs 파일의 640 번째 라인에서 정의되었습니다.
다음을 참조함 : _frameCodec, Dreamine.Communication.Sockets.Servers.TcpServerTransport.TcpClientConnectionEntry.Client, Dreamine.Communication.Sockets.Servers.TcpServerTransport.TcpClientConnectionEntry.ClientId, RemoveClient(), Dreamine.Communication.Sockets.Servers.TcpServerTransport.TcpClientConnectionEntry.SendLock.
다음에 의해서 참조됨 : SendAsync().


|
inlineprivate |
원자적 연산으로 현재 서버 상태를 설정합니다.
| state | 저장할 새 상태입니다. |
TcpServerTransport.cs 파일의 951 번째 라인에서 정의되었습니다.
다음을 참조함 : _state.
다음에 의해서 참조됨 : AcceptLoopAsync(), ConnectAsync(), DisconnectAsync().

|
inlinestaticprivate |
TCP 서버 호스트, 포트, 대기열 및 버퍼 설정을 검증합니다.
| options | 검증할 TCP 서버 설정입니다. |
| ArgumentException | 호스트가 비어 있는 경우 발생합니다. |
| ArgumentOutOfRangeException | 수치 설정이 허용 범위를 벗어난 경우 발생합니다. |
TcpServerTransport.cs 파일의 1054 번째 라인에서 정의되었습니다.
다음을 참조함 : Dreamine.Communication.Sockets.Options.TcpServerTransportOptions.Backlog, Dreamine.Communication.Sockets.Options.TcpServerTransportOptions.Host, Dreamine.Communication.Sockets.Options.TcpServerTransportOptions.Port, Dreamine.Communication.Sockets.Options.TcpServerTransportOptions.ReceiveBufferSize, Dreamine.Communication.Sockets.Options.TcpServerTransportOptions.SendBufferSize.
다음에 의해서 참조됨 : TcpServerTransport().

|
private |
accept Loop Task 값을 보관합니다.
TcpServerTransport.cs 파일의 96 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : ConnectAsync(), DisconnectAsync().
|
private |
clients 값을 보관합니다.
TcpServerTransport.cs 파일의 68 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : AcceptLoopAsync(), CleanupClients(), RemoveClient().
|
private |
frame Codec 값을 보관합니다.
TcpServerTransport.cs 파일의 59 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : ReceiveLoopAsync(), SendToClientAsync(), TcpServerTransport().
|
private |
listener 값을 보관합니다.
TcpServerTransport.cs 파일의 78 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : AcceptLoopAsync(), CleanupListener(), ConnectAsync().
|
private |
options 값을 보관합니다.
TcpServerTransport.cs 파일의 41 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : AcceptLoopAsync(), ConnectAsync(), TcpServerTransport().
|
private |
protocol Adapter 값을 보관합니다.
TcpServerTransport.cs 파일의 50 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : ReceiveLoopAsync(), SendAsync(), TcpServerTransport().
|
private |
server Cts 값을 보관합니다.
TcpServerTransport.cs 파일의 87 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : ConnectAsync(), DisconnectAsync().
|
private |
|
get |
현재 서버에 연결된 TCP 클라이언트 수를 가져옵니다.
TcpServerTransport.cs 파일의 211 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : NotifyConnectedClientCountChanged().
|
get |
TCP 전송 방식을 가져옵니다.
TcpServerTransport.cs 파일의 201 번째 라인에서 정의되었습니다.
|
getset |
기본 송신 작업에서 사용할 클라이언트 대상 정책을 가져오거나 설정합니다.
TcpServerTransport.cs 파일의 221 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : SendAsync().
|
get |
스레드 안전하게 현재 서버 수신 대기 상태를 가져옵니다.
TcpServerTransport.cs 파일의 191 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : AcceptLoopAsync(), ConnectAsync(), DisconnectAsync(), ReceiveLoopAsync(), SendAsync().
| EventHandler<int>? Dreamine.Communication.Sockets.Servers.TcpServerTransport.ConnectedClientCountChanged |
서버에 연결된 클라이언트 수가 변경될 때 발생합니다.
TcpServerTransport.cs 파일의 245 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : NotifyConnectedClientCountChanged().
| EventHandler<MessageEnvelope>? Dreamine.Communication.Sockets.Servers.TcpServerTransport.MessageReceived |
클라이언트 프레임을 메시지로 디코딩했을 때 발생합니다.
TcpServerTransport.cs 파일의 235 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : ReceiveLoopAsync().