LineBufferedSocket

Asynchronous class for client sockets with a line-based protocol.

Constructors

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

Members

Aliases

ReadLineHandler
alias ReadLineHandler = void delegate(LineBufferedSocket sender, string line)
Undocumented in source.

Functions

cancelIdleTimeout
void cancelIdleTimeout()
Undocumented in source. Be warned that the author may not have intended to support it.
disconnect
void disconnect(string reason, DisconnectType type)

Cancel a connection.

resumeIdleTimeout
void resumeIdleTimeout()
Undocumented in source. Be warned that the author may not have intended to support it.
send
void send(string line)

Append a line to the send buffer.

Properties

handleReadLine
ReadLineHandler handleReadLine [@property getter]
ReadLineHandler handleReadLine [@property setter]

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

Variables

delimiter
string delimiter;

The protocol's line delimiter.

Inherited Members

From ClientSocket

connected
bool connected;

Whether the socket is connected.

MAX_PRIORITY
enum MAX_PRIORITY;
Undocumented in source.
DEFAULT_PRIORITY
enum DEFAULT_PRIORITY;
Undocumented in source.
outQueue
Data[][MAX_PRIORITY + 1] outQueue;

The send buffers.

partiallySent
bool[MAX_PRIORITY + 1] partiallySent;

Whether the first item from each queue has been partially sent (and thus can't be cancelled).

disconnecting
bool disconnecting;

Whether a disconnect is pending after all data is sent

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.

onWritable
void onWritable()

Called when a socket is writable.

onError
void onError(string reason)

Called when an error occurs on the socket.

onTask_Idle
void onTask_Idle(Timer timer, TimerTask task)
Undocumented in source. Be warned that the author may not have intended to support it.
tryNextAddress
void tryNextAddress()
Undocumented in source. Be warned that the author may not have intended to support it.
connect
void connect(string host, ushort port)

Start establishing a connection.

DefaultDisconnectReason
auto DefaultDisconnectReason;
Undocumented in source.
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.

send
void send(Data datum, int priority)
void send(Data[] data, int priority)

Append data to the send buffer.

clearQueue
void clearQueue(int priority)
Undocumented in source. Be warned that the author may not have intended to support it.
writePending
bool writePending [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
queuePresent
bool queuePresent(int priority)
Undocumented in source. Be warned that the author may not have intended to support it.
cancelIdleTimeout
void cancelIdleTimeout()
Undocumented in source. Be warned that the author may not have intended to support it.
resumeIdleTimeout
void resumeIdleTimeout()
Undocumented in source. Be warned that the author may not have intended to support it.
setIdleTimeout
void setIdleTimeout(Duration duration)
Undocumented in source. Be warned that the author may not have intended to support it.
markNonIdle
void markNonIdle()
Undocumented in source. Be warned that the author may not have intended to support it.
isConnected
bool isConnected()
Undocumented in source. Be warned that the author may not have intended to support it.
handleConnect
void delegate(ClientSocket sender) handleConnect;

Callback for when a connection has been established.

handleDisconnect
void delegate(ClientSocket sender, string reason, DisconnectType type) handleDisconnect;

Callback for when a connection was closed.

handleIdleTimeout
void delegate(ClientSocket sender) handleIdleTimeout;

Callback for when a connection has stopped responding.

handleBufferFlushed
void delegate(ClientSocket sender) handleBufferFlushed;

Callback for when the send buffer has been flushed.

ReadDataHandler
alias ReadDataHandler = void delegate(ClientSocket sender, Data data)
Undocumented in source.
handleReadData
ReadDataHandler handleReadData [@property getter]
ReadDataHandler handleReadData [@property setter]

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

Meta