TAsyncSocket

Non-blocking socket implementation of the TTransport interface.

Whenever a socket operation would block, TAsyncSocket registers a callback with the specified TAsyncSocketManager and yields.

As for thrift.transport.socket, due to the limitations of std.socket, currently only TCP/IP sockets are supported (i.e. Unix domain sockets are not).

Constructors

this
this(TAsyncSocketManager asyncManager, Socket socket)

Constructor that takes an already created, connected (!) socket.

this
this(TAsyncSocketManager asyncManager, string host, ushort port)

Creates a new unconnected socket that will connect to the given host on the given port.

Members

Functions

asyncManager
TAsyncManager asyncManager()
Undocumented in source. Be warned that the author may not have intended to support it.
close
void close()

Closes the socket.

open
void open()

Asynchronously connects the socket.

peek
bool peek()
Undocumented in source. Be warned that the author may not have intended to support it.
read
size_t read(ubyte[] buf)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(ubyte[] buf)
Undocumented in source. Be warned that the author may not have intended to support it.
writeSome
size_t writeSome(ubyte[] buf)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

connectTimeout
Duration connectTimeout;

The amount of time in which a conncetion must be established before the open() call times out.

Inherited Members

From TSocketBase

isOpen
bool isOpen()

Checks whether the socket is connected.

writeSome
size_t writeSome(ubyte[] buf)

Writes as much data to the socket as there can be in a single OS call.

getPeerAddress
Address getPeerAddress()

Returns the actual address of the peer the socket is connected to.

host
string host()

The host the socket is connected to or will connect to. Null if an already connected socket was used to construct the object.

port
ushort port()

The port the socket is connected to or will connect to. Zero if an already connected socket was used to construct the object.

sendTimeout
Duration sendTimeout()
void sendTimeout(Duration value)

The socket send timeout.

recvTimeout
Duration recvTimeout()
void recvTimeout(Duration value)

The socket receiving timeout. Values smaller than 500 ms are not supported on Windows.

socketHandle
typeof(socket_.handle()) socketHandle()

Returns the OS handle of the underlying socket.

setSocketOpts
void setSocketOpts()

Sets the needed socket options.

host_
string host_;

Remote host.

port_
ushort port_;

Remote port.

sendTimeout_
Duration sendTimeout_;

Timeout for sending.

recvTimeout_
Duration recvTimeout_;

Timeout for receiving.

peerAddress_
Address peerAddress_;

Cached peer address.

peerHost_
string peerHost_;

Cached peer host name.

peerPort_
ushort peerPort_;

Cached peer port.

socket_
Socket socket_;

Wrapped socket object.

From TAsyncTransport

asyncManager
TAsyncManager asyncManager()

The TAsyncManager associated with this transport.

Meta