TAsyncTransport

A TTransport which uses a TAsyncManager to schedule non-blocking operations.

The actual type of device is not specified; typically, implementations will depend on an interface derived from TAsyncManager to be notified of changes in the transport state.

The peeking, reading, writing and flushing methods must always be called from within the associated async manager.

interface TAsyncTransport : TTransport {}

Members

Functions

asyncManager
TAsyncManager asyncManager()

The TAsyncManager associated with this transport.

Inherited Members

From TTransport

isOpen
bool isOpen()

Whether this transport is open.

peek
bool peek()

Tests whether there is more data to read or if the remote side is still open.

open
void open()

Opens the transport for communications.

close
void close()

Closes the transport.

read
size_t read(ubyte[] buf)

Attempts to fill the given buffer by reading data.

readAll
void readAll(ubyte[] buf)

Fills the given buffer by reading data into it, failing if not enough data is available.

readEnd
size_t readEnd()

Must be called by clients when read is completed.

write
void write(ubyte[] buf)

Writes the passed slice of data.

writeEnd
size_t writeEnd()

Must be called by clients when write is completed.

flush
void flush()

Flushes any pending data to be written.

borrow
const(ubyte)[] borrow(ubyte* buf, size_t len)

Attempts to return a slice of <code>len</code> bytes of incoming data, possibly copied into buf, not consuming them (i.e.: a later read will return the same data).

consume
void consume(size_t len)

Remove len bytes from the transport. This must always follow a borrow of at least len bytes, and should always succeed.

Meta