Class CodeStreamConnection
Base connection class for sending commands to the control server
Implements
Inherited Members
Namespace: DuetAPIClient
Assembly: DuetAPIClient.dll
Syntax
public sealed class CodeStreamConnection : BaseConnection, IDisposable
Constructors
CodeStreamConnection()
Creates a new connection in intercepting mode
Declaration
public CodeStreamConnection()
Properties
BufferSize
Maximum number of codes being executed simultaneously
Declaration
public int BufferSize { get; }
Property Value
| Type | Description |
|---|---|
| int |
Channel
Destination channel for incoming codes and source channel for incoming messages
Declaration
public CodeChannel Channel { get; }
Property Value
| Type | Description |
|---|---|
| CodeChannel |
Methods
Connect(int, CodeChannel, string, CancellationToken)
Establish a connection to the given UNIX socket file
Declaration
public Task Connect(int bufferSize = 32, CodeChannel channel = CodeChannel.SBC, string socketPath = "/run/dsf/dcs.sock", CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | bufferSize | Maximum number of codes to execute simultaneously |
| CodeChannel | channel | Destination channel for incoming codes |
| string | socketPath | Path to the UNIX socket file |
| CancellationToken | cancellationToken | Optional cancellation token |
Returns
| Type | Description |
|---|---|
| Task | Asynchronous task |
Exceptions
| Type | Condition |
|---|---|
| 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
Declaration
public NetworkStream GetStream()
Returns
| Type | Description |
|---|---|
| NetworkStream |