ae.net.asockets

Asynchronous socket abstraction.

Public Imports

ae.sys.data
public import ae.sys.data;
Undocumented in source.

Members

Classes

Connection
class Connection
Undocumented in source.
ConnectionAdapter
class ConnectionAdapter

Base class for a connection adapter. By itself, does nothing.

Duplex
class Duplex

Separates reading and writing, e.g. for stdin/stdout.

FileConnection
class FileConnection

A POSIX file stream. Allows adding a file (e.g. stdin/stdout) to the socket manager. Does not dup the given file descriptor, so "disconnecting" this connection will close it.

GenericSocket
class GenericSocket

General methods for an asynchronous socket.

LineBufferedAdapter
class LineBufferedAdapter

Adapter for connections with a line-based protocol. Splits data stream into delimiter-separated lines.

SocketConnection
class SocketConnection

An asynchronous socket-based connection.

SocketServer
class SocketServer

An asynchronous connection server for socket-based connections.

StreamConnection
class StreamConnection
Undocumented in source.
TcpConnection
class TcpConnection

An asynchronous TCP connection.

TcpServer
class TcpServer

An asynchronous TCP connection server.

TimeoutAdapter
class TimeoutAdapter

Fires an event handler or disconnects connections after a period of inactivity.

UdpConnection
class UdpConnection

An asynchronous UDP stream. UDP does not have connections, so this class encapsulates a socket with a fixed destination (sendto) address, and optionally bound to a local address. Currently received packets' address is not exposed.

Enums

ConnectionState
enum ConnectionState
Undocumented in source.
DisconnectType
enum DisconnectType
Undocumented in source.

Functions

addIdleHandler
void addIdleHandler(SocketManager socketManager, void delegate() handler)
Undocumented in source. Be warned that the author may not have intended to support it.
disconnectable
bool disconnectable(ConnectionState state)

Returns true if this is a connection state for which disconnecting is valid. Generally, applications should be aware of the life cycle of their sockets, so checking the state of a connection is unnecessary (and a code smell). However, unconditionally disconnecting some connected sockets can be useful when it needs to occur "out-of-bound" (not tied to the application normal life cycle), such as in response to a signal.

removeIdleHandler
void removeIdleHandler(SocketManager socketManager, Args args)
Undocumented in source. Be warned that the author may not have intended to support it.

Imports

Address (from std.socket)
public import std.socket : Address, AddressInfo, Socket;
Undocumented in source.
AddressInfo (from std.socket)
public import std.socket : Address, AddressInfo, Socket;
Undocumented in source.
Socket (from std.socket)
public import std.socket : Address, AddressInfo, Socket;
Undocumented in source.

Interfaces

IConnection
interface IConnection

Common interface for connections and adapters.

Manifest constants

USE_SLEEP
enum USE_SLEEP;
Undocumented in source.
USE_SLEEP
enum USE_SLEEP;
Undocumented in source.

Static functions

isFun
bool isFun(T a, T b)
Undocumented in source. Be warned that the author may not have intended to support it.

Structs

SocketManager
struct SocketManager
Undocumented in source.
SocketManager
struct SocketManager
Undocumented in source.

Variables

eventCounter
int eventCounter;

Flags that determine socket wake-up events.

socketManager
SocketManager socketManager;

The default socket manager.

Meta

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Authors

Stéphan Kochen <stephan@kochen.nl> Vladimir Panteleev <vladimir@thecybershadow.net> Vincent Povirk <madewokherd@gmail.com> Simon Arlott