Class CodeStreamConnection
- Namespace
- DuetAPIClient
- Assembly
- DuetAPIClient.dll
Base connection class for sending commands to the control server
public sealed class CodeStreamConnection : BaseConnection, IDisposable
- Inheritance
-
CodeStreamConnection
- Implements
- Inherited Members
Constructors
CodeStreamConnection()
Creates a new connection in intercepting mode
public CodeStreamConnection()
Properties
BufferSize
Maximum number of codes being executed simultaneously
public int BufferSize { get; }
Property Value
Channel
Destination channel for incoming codes and source channel for incoming messages
public CodeChannel Channel { get; }
Property Value
Methods
Connect(int, CodeChannel, string?)
Establish a connection to the given UNIX socket file
public void Connect(int bufferSize = 32, CodeChannel channel = CodeChannel.SBC, string? socketPath = null)
Parameters
bufferSizeintMaximum number of codes to execute simultaneously
channelCodeChannelDestination channel for incoming codes
socketPathstringOptional path to the DCS UNIX socket file
Exceptions
- IncompatibleVersionException
API level is incompatible
- IOException
Connection mode is unavailable
- SocketException
Init message could not be processed
ConnectAsync(int, CodeChannel, string?, CancellationToken)
Establish a connection to the given UNIX socket file asynchronously
public Task ConnectAsync(int bufferSize = 32, CodeChannel channel = CodeChannel.SBC, string? socketPath = null, CancellationToken cancellationToken = default)
Parameters
bufferSizeintMaximum number of codes to execute simultaneously
channelCodeChannelDestination channel for incoming codes
socketPathstringOptional path to the DCS UNIX socket file
cancellationTokenCancellationTokenOptional cancellation token
Returns
- Task
Asynchronous task
Exceptions
- IncompatibleVersionException
API level is incompatible
- IOException
Connection mode is unavailable
- OperationCanceledException
Operation has been cancelled
- SocketException
Init message could not be processed
GetStream()
Get a network stream for input/output of codes
public NetworkStream GetStream()