|
| bool | init () |
| | Initializes the handle. The actual socket is created lazily. More...
|
| |
| void | open (OSSocketHandle socket) |
| | Opens an existing file descriptor or SOCKET as a UDP handle. More...
|
| |
| template<typename I = IPv4> |
| void | bind (std::string ip, unsigned int port, Flags< Bind > opts=Flags< Bind >{}) |
| | Binds the UDP handle to an IP address and port. More...
|
| |
| template<typename I = IPv4> |
| void | bind (Addr addr, Flags< Bind > opts=Flags< Bind >{}) |
| | Binds the UDP handle to an IP address and port. More...
|
| |
| template<typename I = IPv4> |
| Addr | sock () const noexcept |
| | Get the local IP and port of the UDP handle. More...
|
| |
| template<typename I = IPv4> |
| bool | multicastMembership (std::string multicast, std::string iface, Membership membership) |
| | Sets membership for a multicast address. More...
|
| |
| bool | multicastLoop (bool enable=true) |
| | Sets IP multicast loop flag. More...
|
| |
| bool | multicastTtl (int val) |
| | Sets the multicast ttl. More...
|
| |
| template<typename I = IPv4> |
| bool | multicastInterface (std::string iface) |
| | Sets the multicast interface to send or receive data on. More...
|
| |
| bool | broadcast (bool enable=false) |
| | Sets broadcast on or off. More...
|
| |
| bool | ttl (int val) |
| | Sets the time to live. More...
|
| |
| template<typename I = IPv4> |
| void | send (std::string ip, unsigned int port, std::unique_ptr< char[]> data, unsigned int len) |
| | Sends data over the UDP socket. More...
|
| |
| template<typename I = IPv4> |
| void | send (Addr addr, std::unique_ptr< char[]> data, unsigned int len) |
| | Sends data over the UDP socket. More...
|
| |
| template<typename I = IPv4> |
| void | send (std::string ip, unsigned int port, char *data, unsigned int len) |
| | Sends data over the UDP socket. More...
|
| |
| template<typename I = IPv4> |
| void | send (Addr addr, char *data, unsigned int len) |
| | Sends data over the UDP socket. More...
|
| |
| template<typename I = IPv4> |
| int | trySend (std::string ip, unsigned int port, std::unique_ptr< char[]> data, unsigned int len) |
| | Sends data over the UDP socket. More...
|
| |
| template<typename I = IPv4> |
| int | trySend (Addr addr, std::unique_ptr< char[]> data, unsigned int len) |
| | Sends data over the UDP socket. More...
|
| |
| template<typename I = IPv4> |
| int | trySend (std::string ip, unsigned int port, char *data, unsigned int len) |
| | Sends data over the UDP socket. More...
|
| |
| template<typename I = IPv4> |
| int | trySend (Addr addr, char *data, unsigned int len) |
| | Sends data over the UDP socket. More...
|
| |
| template<typename I = IPv4> |
| void | recv () |
| | Prepares for receiving data. More...
|
| |
|
void | stop () |
| | Stops listening for incoming datagrams.
|
| |
Public Member Functions inherited from uvw::Handle< UDPHandle, uv_udp_t > |
| HandleCategory | category () const noexcept override |
| | Gets the category of the handle. More...
|
| |
| HandleType | type () const noexcept override |
| | Gets the type of the handle. More...
|
| |
| bool | active () const noexcept override |
| | Checks if the handle is active. More...
|
| |
| bool | closing () const noexcept override |
| | Checks if a handle is closing or closed. More...
|
| |
| void | close () noexcept override |
| | Request handle to be closed. More...
|
| |
| void | reference () noexcept override |
| | Reference the given handle. More...
|
| |
| void | unreference () noexcept override |
| | Unreference the given handle. More...
|
| |
| bool | referenced () const noexcept override |
| | Checks if the given handle referenced. More...
|
| |
| std::size_t | size () const noexcept |
| | Returns the size of the underlying handle type. More...
|
| |
| int | sendBufferSize () |
| | Gets the size of the send buffer used for the socket. More...
|
| |
| bool | sendBufferSize (int value) |
| | Sets the size of the send buffer used for the socket. More...
|
| |
| int | recvBufferSize () |
| | Gets the size of the receive buffer used for the socket. More...
|
| |
| bool | recvBufferSize (int value) |
| | Sets the size of the receive buffer used for the socket. More...
|
| |
| OSFileDescriptor | fileno () const |
| | Gets the platform dependent file descriptor equivalent. More...
|
| |
| Loop & | loop () const noexcept |
| | Gets the loop from which the resource was originated. More...
|
| |
| Connection< E > | on (Listener< E > f) |
| | Registers a long-lived listener with the event emitter. More...
|
| |
| Connection< E > | once (Listener< E > f) |
| | Registers a short-lived listener with the event emitter. More...
|
| |
| void | erase (Connection< E > conn) noexcept |
| | Disconnects a listener from the event emitter. More...
|
| |
|
void | clear () noexcept |
| | Disconnects all the listeners for the given event type.
|
| |
|
void | clear () noexcept |
| | Disconnects all the listeners.
|
| |
| bool | empty () const noexcept |
| | Checks if there are listeners registered for the specific event. More...
|
| |
| bool | empty () const noexcept |
| | Checks if there are listeners registered with the event emitter. More...
|
| |
The UDPHandle handle.
UDP handles encapsulate UDP communication for both clients and servers.
By default, IPv4 is used as a template parameter. The handle already supports IPv6 out-of-the-box by using uvw::IPv6.
To create an UDPHandle through a Loop, arguments follow:
- An optional integer value that indicates optional flags used to initialize the socket.
See the official documentation for further details.
Definition at line 99 of file udp.hpp.