TcpSocket

Specialized socket using the TCP protocol.

Constructors

this
this()

Default constructor.

Destructor

~this
~this()

Destructor.

Members

Functions

connect
Status connect(IpAddress host, ushort port, Duration timeout = Duration.zero())

Connect the socket to a remote peer.

disconnect
void disconnect()

Disconnect the socket from its remote peer.

getLocalPort
ushort getLocalPort()

Get the port to which the socket is bound locally.

getRemoteAddress
IpAddress getRemoteAddress()

Get the address of the connected peer.

getRemotePort
ushort getRemotePort()

Get the port of the connected peer to which the socket is connected.

isBlocking
bool isBlocking()

Tell whether the socket is in blocking or non-blocking mode.

receive
Status receive(Packet packet)

Receive a formatted packet of data from the remote peer.

receive
Status receive(void[] data, out size_t sizeReceived)

Receive raw data from the remote peer.

send
Status send(const(void)[] data)

Send raw data to the remote peer.

send
Status send(Packet packet)

Send a formatted packet of data to the remote peer.

setBlocking
void setBlocking(bool blocking)

Set the blocking state of the socket.

Inherited Members

From Socket

Status
enum Status

Status codes that may be returned by socket functions.

AnyPort
enum AnyPort;

Special value that tells the system to pick any available port.

setBlocking
void setBlocking(bool blocking)

Set the blocking state of the socket.

isBlocking
bool isBlocking()

Tell whether the socket is in blocking or non-blocking mode.

Meta