From cdb85b87c07cdd912c765cdbfe3e32586cc34b0a Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 14 May 2021 16:05:16 +0200 Subject: Add EDI UDP multicast support --- src/input/Edi.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/input/Edi.cpp b/src/input/Edi.cpp index e206f28..338a8e6 100644 --- a/src/input/Edi.cpp +++ b/src/input/Edi.cpp @@ -80,6 +80,7 @@ Edi::~Edi() { void Edi::open(const std::string& name) { const std::regex re_udp("udp://:([0-9]+)"); + const std::regex re_udp_multicast("udp://@([0-9.]+):([0-9]+)"); const std::regex re_tcp("tcp://(.*):([0-9]+)"); lock_guard lock(m_mutex); @@ -95,7 +96,14 @@ void Edi::open(const std::string& name) m_input_used = InputUsed::UDP; m_udp_sock.reinit(udp_port); m_udp_sock.setBlocking(false); - // TODO multicast + } + else if (std::regex_match(name, m, re_udp_multicast)) { + const string multicast_address = m[1].str(); + const int udp_port = std::stoi(m[2].str()); + m_input_used = InputUsed::UDP; + m_udp_sock.reinit(udp_port); + m_udp_sock.setBlocking(false); + m_udp_sock.joinGroup(multicast_address.c_str()); } else if (std::regex_match(name, m, re_tcp)) { m_input_used = InputUsed::TCP; -- cgit v1.2.3