Class RfbMessageSender
A background thread that sends queued messages and provides methods to add messages to the send queue.
Inherited Members
Namespace: MarcusW.VncClient.Protocol.Implementation.Services.Communication
Assembly: MarcusW.VncClient.dll
Syntax
public class RfbMessageSender : BackgroundThread, IRfbMessageSender, IBackgroundThread, IDisposable
Constructors
| Improve this Doc View SourceRfbMessageSender(RfbConnectionContext)
Initializes a new instance of the RfbMessageSender.
Declaration
public RfbMessageSender(RfbConnectionContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| RfbConnectionContext | context | The connection context. |
Methods
| Improve this Doc View SourceDispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
Overrides
| Improve this Doc View SourceEnqueueInitialMessages(CancellationToken)
Enqueues some initial messages to get things rolling.
Declaration
public void EnqueueInitialMessages(CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | The cancellation token. |
EnqueueMessage<TMessageType>(IOutgoingMessage<TMessageType>, CancellationToken)
Adds the message to the send queue and returns without waiting for it being sent.
Declaration
public void EnqueueMessage<TMessageType>(IOutgoingMessage<TMessageType> message, CancellationToken cancellationToken = null)
where TMessageType : class, IOutgoingMessageType
Parameters
| Type | Name | Description |
|---|---|---|
| IOutgoingMessage<TMessageType> | message | The message to send. |
| CancellationToken | cancellationToken | The cancellation token. |
Type Parameters
| Name | Description |
|---|---|
| TMessageType | The type of the message. |
Remarks
Please ensure the outgoing message type is marked as being supported by both sides before sending it. See UsedMessageTypes.
SendMessageAndWait<TMessageType>(IOutgoingMessage<TMessageType>, CancellationToken)
Adds the message to the send queue and waits synchronously for the message being sent.
Declaration
public void SendMessageAndWait<TMessageType>(IOutgoingMessage<TMessageType> message, CancellationToken cancellationToken = null)
where TMessageType : class, IOutgoingMessageType
Parameters
| Type | Name | Description |
|---|---|---|
| IOutgoingMessage<TMessageType> | message | The message to send. |
| CancellationToken | cancellationToken | The cancellation token. |
Type Parameters
| Name | Description |
|---|---|
| TMessageType | The type of the message. |
Remarks
Please ensure the outgoing message type is marked as being supported by both sides before sending it. See UsedMessageTypes.
SendMessageAndWaitAsync<TMessageType>(IOutgoingMessage<TMessageType>, CancellationToken)
Adds the message to the send queue and returns a
Declaration
public Task SendMessageAndWaitAsync<TMessageType>(IOutgoingMessage<TMessageType> message, CancellationToken cancellationToken = null)
where TMessageType : class, IOutgoingMessageType
Parameters
| Type | Name | Description |
|---|---|---|
| IOutgoingMessage<TMessageType> | message | The message to send. |
| CancellationToken | cancellationToken | The cancellation token. |
Returns
| Type | Description |
|---|---|
| Task |
Type Parameters
| Name | Description |
|---|---|
| TMessageType | The type of the message. |
Remarks
Please ensure the outgoing message type is marked as being supported by both sides before sending it. See UsedMessageTypes.
StartSendLoop()
Starts the send loop.
Declaration
public void StartSendLoop()
StopSendLoopAsync()
Stops the send loop and waits for completion.
Declaration
public Task StopSendLoopAsync()
Returns
| Type | Description |
|---|---|
| Task |
ThreadWorker(CancellationToken)
Declaration
protected override void ThreadWorker(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |