libasync.socket

Undocumented in source.

Public Imports

std.socket
public import std.socket : SocketType, SocketOSException;
libasync.internals.socket_compat
public import libasync.internals.socket_compat : SOCK_STREAM, SOCK_SEQPACKET, SOCK_DGRAM, SOCK_RAW, SOCK_RDM, AF_INET, AF_INET6, SOL_SOCKET, SO_REUSEADDR;
libasync.internals.socket_compat
public import libasync.internals.socket_compat : AF_UNIX, SO_REUSEPORT;

Members

Classes

AsyncSocket
class AsyncSocket

Proactor-model inspired asynchronous socket implementation. In contrast to POSIX.1-2013 readiness I/O - which essentially describes synchronous socket I/O operations with asynchronous notification of future blocking behaviour for said operations - this provides an API for asynchronous socket I/O operations: The three major socket operations accept, receive, and send modeled by this API will submit a request for asynchronous completion; towards that end, each call to these must be provided with a callback that will be called to notify you of said competion. It is therefore not recommended to keep calling any of these three methods in rapid succession, as they will normally not fail (bugs, memory exhaustion, or the operating system not supporting further pending requests excluded) to notify you that you should try again later. They will, however, notify you via the callbacks you provide once a request has been completed, or once there has been a socket error (refer to OnError). It follows that you should usually have only a small number of requests pending on a socket at the same time (preferably at most only a single receive and a single send - respectively a single accept) and submit the next request only once the previous one (of the same type) notifies you of its completion. For connection-oriented, active sockets, connection completion and disconnect (by the remote peer) are handled by OnConnect and OnClose respectively; disconnecting from the remote peer can be initiated with kill and will not trigger OnClose.

Functions

isConnectionOriented
bool isConnectionOriented(SocketType type)

Returns true if the given type of socket is connection-oriented.

isDatagramOriented
bool isDatagramOriented(SocketType type)

Returns true if the given type of socket is datagram-oriented.

isSocket
bool isSocket(fd_t fd)

Checks whether the given file descriptor refers to a valid socket.

Manifest constants

INVALID_SOCKET
enum INVALID_SOCKET;
Undocumented in source.
SOCKET_ERROR
enum SOCKET_ERROR;
Undocumented in source.

Structs

AsyncAcceptRequest
struct AsyncAcceptRequest

Represents a single request to asynchronously accept an incoming connection.

AsyncReceiveRequest
struct AsyncReceiveRequest

Represents a single request to asynchronously receive data.

AsyncSendRequest
struct AsyncSendRequest

Represents a single request to asynchronously send data.

NetworkAddress
struct NetworkAddress

Represents a network/socket address. (adapted from vibe.core.net)

NetworkMessage
struct NetworkMessage

Represents a single message to be transferred over the network by AsyncSocket.

SocketInfo
struct SocketInfo

Holds additional information about a socket.

Meta