TSocket

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

Constructors

this
this(Socket socket)
this
this(string host, ushort port)

Members

Functions

close
void close()

Closes the socket.

maxRecvRetries
ushort maxRecvRetries()
void maxRecvRetries(ushort value)

Maximum number of retries for receiving from socket on read() in case of EAGAIN/EINTR.

open
void open()

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.
recvTimeout
void recvTimeout(Duration value)
Undocumented in source. Be warned that the author may not have intended to support it.
sendTimeout
void sendTimeout(Duration value)
Undocumented in source. Be warned that the author may not have intended to support it.
setSocketOpts
void setSocketOpts()
Undocumented in source. Be warned that the author may not have intended to support it.
setTimeout
void setTimeout(SocketOption type, Duration value)
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.

Manifest constants

DEFAULT_MAX_RECV_RETRIES
enum DEFAULT_MAX_RECV_RETRIES;

Maximum number of retries for receiving from socket on read() in case of EAGAIN/EINTR.

Variables

maxRecvRetries_
ushort maxRecvRetries_;

Maximum number of recv() retries.

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.

Meta