UdpSocket

Specialized socket using the UDP protocol.

Constructors

this
this()

Default constructor.

Destructor

~this
~this()

Destructor.

Members

Functions

bind
Status bind(ushort port, IpAddress address = IpAddress.Any)

Bind the socket to a specific port.

getLocalPort
ushort getLocalPort()

Get the port to which the socket is bound locally.

isBlocking
bool isBlocking()

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

receive
Status receive(void[] data, out size_t sizeReceived, out IpAddress address, out ushort port)

Receive raw data from a remote peer.

receive
Status receive(Packet packet, out IpAddress address, out ushort port)

Receive a formatted packet of data from a remote peer.

send
Status send(const(void)[] data, IpAddress address, ushort port)

Send raw data to a remote peer.

send
Status send(Packet packet, IpAddress address, ushort port)

Send a formatted packet of data to a remote peer.

setBlocking
void setBlocking(bool blocking)

Set the blocking state of the socket.

unbind
void unbind()

Unbind the socket from the local port to which it is bound.

Manifest constants

maxDatagramSize
enum maxDatagramSize;

The maximum number of bytes that can be sent in a single UDP datagram.

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