12345678910111213141516171819202122232425262728293031323334353637383940module juptune.event.io;
struct PosixUdpSocket
{
/++ ALIASES ++/
///
alias __xdtor = __MARMOS_BUG__;
/++ FUNCTIONS ++/
///
Result close();
/// Connects to the target address.
Result connect(const const char[] address, ushort defaultPort = cast(ushort)0u);
/// Connects to the target address.
Result connect(IpAddress address);
/// The IP address of this socket.
IpAddress ip();
///
bool isOpen();
///
static Result makePair(PosixTcpSocket[2LU] sockets);
///
PosixUdpSocket opAssign(PosixUdpSocket p);
/// Creates the underlying socket.
Result open();
/// Receives a single datagram, potentially from the "connected" host, or from any clients on the port this socket is listening to.
Result recvmsg(void[][] scatteredDataToReceive, ulong bytesRead, Nullable!(IpAddress) senderIp, Duration timeout = zero());
/// Sends a single datagram either to the "connected" host, or to a specific host if there's no active "connection".
Result sendmsg(const const const void[][] scatteredDataToSend, Nullable!(IpAddress) target = Nullable(DontCallDestructorT(), true), Duration timeout = zero());
///
void wrap(int fd);
/++ MANIFEST CONSTANTS ++/
///
enum int MAX_SCATTERED_ARRAYS = 8;
}
A UdpSocketimplementation that uses the standard POSIX socket functions for when io_uring doesn't provide a native opcode.
When a function has to use a standard POSIX function instead of io_uring, it may block the thread.
Due to the nature of UDP, GenericIoDriverisn't used and so a bit of a different interface is provided.
GenericIoDriver
| Name | Description |
|---|---|
| __xdtor |
| Name | Description |
|---|---|
| MAX_SCATTERED_ARRAYS |
| Name | Description |
|---|---|
| close | |
| connect |
Connects to the target address. |
| connect |
Connects to the target address. |
| ip |
The IP address of this socket. |
| isOpen | |
| makePair | |
| opAssign | |
| open |
Creates the underlying socket. |
| recvmsg |
Receives a single datagram, potentially from the "connected" host, or from any clients on the port this socket is listening to. |
| sendmsg |
Sends a single datagram either to the "connected" host, or to a specific host if there's no active "connection". |
| wrap |