Marmos
v juptune
v asn1
v lang
v ast
v Classes
v Enums
v ir
v parser
v Enums
v Structs
v core
v crypto
v keyexchange
v memory
v data
v alphabet
v buffer
v json
v builder
v parser
v Enums
v Structs
v serialise
v Structs
v Templates
v pem
v Enums
v Structs

Structs PosixUdpSocket

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module 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;
    
}

Documentation

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.

See_Also

GenericIoDriver

Aliases

Name Description
__xdtor

Constants

Name Description
MAX_SCATTERED_ARRAYS

Functions

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