- class TSocketBase : TBaseTransport [abstract] ¶
-
Common parts of a socket TTransport implementation, regardless of how the
actual I/O is performed (sync/async).
- this(Socket socket) ¶
-
Constructor that takes an already created, connected (!) socket.
socket | Already created, connected socket object. |
- this(string host, ushort port) ¶
-
Creates a new unconnected socket that will connect to the given host
on the given port.
host | Remote host. |
port | Remote port. |
- bool isOpen() [@property, override] ¶
-
Checks whether the socket is connected.
- size_t writeSome(in ubyte[] buf) [abstract] ¶
-
Writes as much data to the socket as there can be in a single OS call.
The actual number of bytes written. Never more than buf.length.
- Address getPeerAddress() ¶
-
Returns the actual address of the peer the socket is connected to.
In contrast, the host and port properties contain the address used to
establish the connection, and are not updated after the connection.
The socket must be open when calling this.
- string host() [@property, const] ¶
-
The host the socket is connected to or will connect to. Null if an
already connected socket was used to construct the object.
- ushort port() [@property, const] ¶
-
The port the socket is connected to or will connect to. Zero if an
already connected socket was used to construct the object.
- Duration sendTimeout() [@property, const] ¶
- void sendTimeout(Duration value) [@property] ¶
-
- Duration recvTimeout() [@property, const] ¶
- void recvTimeout(Duration value) [@property] ¶
-
The socket receiving timeout. Values smaller than 500 ms are not
supported on Windows.
- typeof(socket_.handle()) socketHandle() [@property] ¶
-
Returns the OS handle of the underlying socket.
Should not usually be used directly, but access to it can be necessary
to interface with C libraries.
- void setSocketOpts() [protected] ¶
-
Sets the needed socket options.
- string host_ [protected] ¶
-
- ushort port_ [protected] ¶
-
- Duration sendTimeout_ [protected] ¶
-
- Duration recvTimeout_ [protected] ¶
-
- Address peerAddress_ [protected] ¶
-
- string peerHost_ [protected] ¶
-
- ushort peerPort_ [protected] ¶
-
- Socket socket_ [protected] ¶
-
- class TSocket : TSocketBase ¶
-
Socket implementation of the TTransport interface.
Due to the limitations of std.socket, currently only TCP/IP sockets are
supported (i.e. Unix domain sockets are not).
- this(Socket socket) ¶
- this(string host, ushort port) ¶
- void open() [override] ¶
-
- void close() [override] ¶
-
- ushort maxRecvRetries() [@property, const] ¶
- void maxRecvRetries(ushort value) [@property] ¶
- auto DEFAULT_MAX_RECV_RETRIES [manifest] ¶
-
Maximum number of retries for receiving from socket on read() in case of
EAGAIN/EINTR.
- ushort maxRecvRetries_ [protected] ¶
-
Maximum number of recv() retries.