StreamConnection

Implements a stream connection. Queued Data is allowed to be fragmented.

Constructors

this
this()
Undocumented in source.
this
this(Socket conn)
Undocumented in source.

Members

Functions

onWritable
void onWritable()

Called when a socket is writable.

Inherited Members

From Connection

state
ConnectionState state [@property getter]

Get connection state.

doSend
sizediff_t doSend(void[] buffer)
Undocumented in source.
doReceive
sizediff_t doReceive(void[] buffer)
Undocumented in source.
outQueue
DataVec[MAX_PRIORITY + 1] outQueue;

The send buffers.

partiallySent
int partiallySent;

Whether the first item from this queue (if any) has been partially sent (and thus can't be canceled).

updateFlags
void updateFlags()
Undocumented in source. Be warned that the author may not have intended to support it.
onReadable
void onReadable()

Called when a socket is readable.

onError
void onError(string reason)

Called when an error occurs on the socket.

disconnect
void disconnect(string reason, DisconnectType type)

Close a connection. If there is queued data waiting to be sent, wait until it is sent before disconnecting. The disconnect handler will be called immediately, even when not all data has been flushed yet.

send
void send(Data[] data, int priority)
alias send = IConnection.send

Append data to the send buffer.

clearQueue
void clearQueue(int priority)

Cancel all queued Data packets with the given priority. Does not cancel any partially-sent Data.

writePending
bool writePending [@property getter]

Returns true if any queues have pending data.

queuePresent
bool queuePresent(int priority)

Returns true if there are any queued Data which have not yet begun to be sent.

packetsQueued
size_t packetsQueued(int priority)

Returns the number of queued Data at the given priority.

bytesQueued
size_t bytesQueued(int priority)

Returns the number of queued bytes at the given priority.

handleConnect
ConnectHandler handleConnect [@property setter]

Callback for when a connection has been established.

handleReadData
ReadDataHandler handleReadData [@property setter]

Callback for incoming data. Data will not be received unless this handler is set.

handleDisconnect
DisconnectHandler handleDisconnect [@property setter]

Callback for when a connection was closed.

handleBufferFlushed
BufferFlushedHandler handleBufferFlushed [@property setter]

Callback setter for when all queued data has been sent.

Meta