thrift.transport.socket

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.

Parameters:

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

Parameters:

hostRemote host.
portRemote 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.

Parameters:

bufData to write.

Returns:

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]
The socket send timeout.
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]
Remote host.
ushort port_ [protected]
Remote port.
Duration sendTimeout_ [protected]
Timeout for sending.
Duration recvTimeout_ [protected]
Timeout for receiving.
Address peerAddress_ [protected]
Cached peer address.
string peerHost_ [protected]
Cached peer host name.
ushort peerPort_ [protected]
Cached peer port.
Socket socket_ [protected]
Wrapped socket object.
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]
Connects the socket.
void close() [override]
Closes the socket.
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.