ClientSocket

An asynchronous client socket.

Constructors

this
this(Socket conn)

Constructor used by a ServerSocket for new connections

this
this()

Default constructor

Members

Aliases

ReadDataHandler
alias ReadDataHandler = void delegate(ClientSocket sender, Data data)
Undocumented in source.

Functions

cancelIdleTimeout
void cancelIdleTimeout()
Undocumented in source. Be warned that the author may not have intended to support it.
clearQueue
void clearQueue(int priority)
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.

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.

isConnected
bool isConnected()
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.
onError
void onError(string reason)

Called when an error occurs on the socket.

onReadable
void onReadable()

Called when a socket is readable.

onTask_Idle
void onTask_Idle(Timer timer, TimerTask task)
Undocumented in source. Be warned that the author may not have intended to support it.
onWritable
void onWritable()

Called when a socket is writable.

queuePresent
bool queuePresent(int priority)
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.
send
void send(Data datum, int priority)
void send(Data[] data, int priority)

Append data to the send buffer.

setIdleTimeout
void setIdleTimeout(Duration duration)
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.
updateFlags
void updateFlags()
Undocumented in source. Be warned that the author may not have intended to support it.

Manifest constants

DEFAULT_PRIORITY
enum DEFAULT_PRIORITY;
Undocumented in source.
MAX_PRIORITY
enum MAX_PRIORITY;
Undocumented in source.

Properties

handleReadData
ReadDataHandler handleReadData [@property getter]
ReadDataHandler handleReadData [@property setter]

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

writePending
bool writePending [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

DefaultDisconnectReason
auto DefaultDisconnectReason;
Undocumented in source.

Variables

connected
bool connected;

Whether the socket is connected.

disconnecting
bool disconnecting;

Whether a disconnect is pending after all data is sent

handleBufferFlushed
void delegate(ClientSocket sender) handleBufferFlushed;

Callback for when the send buffer has been flushed.

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.

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).

Inherited Members

From GenericSocket

__anonymous
mixin SocketMixin

Declares notifyRead and notifyWrite.

conn
Socket conn;

The socket this class wraps.

socket
Socket socket [@property getter]

Retrieve the socket class this class wraps.

onReadable
void onReadable()
Undocumented in source. Be warned that the author may not have intended to support it.
onWritable
void onWritable()
Undocumented in source. Be warned that the author may not have intended to support it.
onError
void onError(string reason)
Undocumented in source. Be warned that the author may not have intended to support it.
daemon
bool daemon;

Don't block the process from exiting. TODO: Not implemented with libev

localAddress
Address localAddress [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
remoteAddress
Address remoteAddress [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
setKeepAlive
void setKeepAlive(bool enabled, int time, int interval)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta