Abstract base class for network sockets.
Definition abstractsocket.h:38
int _fd
Socket file descriptor.
Definition abstractsocket.h:203
Generic memory buffer descriptor with alignment and memory space support.
Definition buffer.h:85
Lightweight error code wrapper for the promeki library.
Definition error.h:39
OpenMode
Mode flags controlling how a device is opened.
Definition iodevice.h:33
virtual Result< int64_t > size() const
Returns the total size of the device in bytes.
Dynamic array container wrapping std::vector.
Definition list.h:40
Base object for promeki.
Definition objectbase.h:129
ObjectBase * parent() const
Returns the parent object, if one. nullptr if none.
Definition objectbase.h:258
Network address with port number.
Definition socketaddress.h:50
Encoding-aware string class with copy-on-write semantics.
Definition string.h:35
Datagram-oriented UDP socket with multicast support.
Definition udpsocket.h:47
ssize_t readDatagram(void *data, size_t maxSize, SocketAddress *sender=nullptr)
Receives a datagram.
int64_t read(void *data, int64_t maxSize) override
Reads data from a connected UDP socket.
ssize_t pendingDatagramSize() const
Returns the size of the next pending datagram.
Error openIpv6(OpenMode mode)
Opens the socket for IPv6 operation.
~UdpSocket() override
Destructor.
int64_t write(const void *data, int64_t maxSize) override
Writes data to a connected UDP socket.
Error leaveMulticastGroup(const SocketAddress &group)
Leaves a multicast group.
Error joinMulticastGroup(const SocketAddress &group, const String &iface)
Joins a multicast group on a specific interface.
Error setMulticastTTL(int ttl)
Sets the multicast TTL (time to live).
Error joinMulticastGroup(const SocketAddress &group)
Joins a multicast group.
Error setMulticastLoopback(bool enable)
Enables or disables multicast loopback.
bool isOpen() const override
Returns true if the socket is open.
Definition udpsocket.h:88
UdpSocket(ObjectBase *parent=nullptr)
Constructs a UdpSocket.
Error setDscp(uint8_t dscp)
Sets the DSCP (Differentiated Services) value.
ssize_t writeDatagram(const void *data, size_t size, const SocketAddress &dest)
Sends a datagram to a specific destination.
int64_t bytesAvailable() const override
Returns the number of bytes available for reading.
bool hasPendingDatagrams() const
Returns true if there are pending datagrams to read.
Error setMulticastInterface(const String &iface)
Sets the outgoing multicast interface.
Error setReuseAddress(bool enable)
Enables or disables SO_REUSEADDR.
Error open(OpenMode mode) override
Opens the socket.
Error close() override
Closes the socket.
ssize_t writeDatagram(const Buffer &data, const SocketAddress &dest)
Sends a Buffer as a datagram.
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19