diff --git a/inc/udpsocket.hpp b/inc/udpsocket.hpp index 83d03a5aa17bc746afd2865627e8e66ea587882e..8e0a3640cc349049803b37cc1a1c2c878f3eac9c 100644 --- a/inc/udpsocket.hpp +++ b/inc/udpsocket.hpp @@ -35,6 +35,13 @@ private: public: + /** + * @brief Create a UdpSocket that will be bound to Ipv4 0.0.0.0 and the + * port 0. This will use a random free port and is useful for sending + * only. + */ + UdpSocket(); + /** * @brief Create a UdpSocket that will be bound to the local address and * port that is specified in the SockAddr. diff --git a/src/udpsocket.cpp b/src/udpsocket.cpp index 91744c2c7cbfa75ec256f0bbc55451bbaea15cc6..89234e4fbd539c7e57e913bd90d5234e8a26aef5 100644 --- a/src/udpsocket.cpp +++ b/src/udpsocket.cpp @@ -7,6 +7,10 @@ #include <poll.h> +UdpSocket::UdpSocket() + : UdpSocket{"0.0.0.0", 0} +{ } + UdpSocket::UdpSocket(SockAddr _local) : local{_local}, sockfd{0} {