Table of Contents

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

int

Channel

Destination channel for incoming codes and source channel for incoming messages

public CodeChannel Channel { get; }

Property Value

CodeChannel

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

bufferSize int

Maximum number of codes to execute simultaneously

channel CodeChannel

Destination channel for incoming codes

socketPath string

Optional 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

bufferSize int

Maximum number of codes to execute simultaneously

channel CodeChannel

Destination channel for incoming codes

socketPath string

Optional path to the DCS UNIX socket file

cancellationToken CancellationToken

Optional 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()

Returns

NetworkStream

See Also