aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Socket.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2024-08-20 15:02:41 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2024-08-20 15:02:41 +0200
commit11a5d823958ec103c6a473a7fa322847ca74dee7 (patch)
treeda094c781430dae17816a4f264fe93261da4aea2 /lib/Socket.h
parent2306377230caee715de737ba6edd68e8a878fa97 (diff)
downloaddabmod-11a5d823958ec103c6a473a7fa322847ca74dee7.tar.gz
dabmod-11a5d823958ec103c6a473a7fa322847ca74dee7.tar.bz2
dabmod-11a5d823958ec103c6a473a7fa322847ca74dee7.zip
Common: improve multicast reception
Diffstat (limited to 'lib/Socket.h')
-rw-r--r--lib/Socket.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Socket.h b/lib/Socket.h
index 44f93d0..1320a64 100644
--- a/lib/Socket.h
+++ b/lib/Socket.h
@@ -2,7 +2,7 @@
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Her Majesty the
Queen in Right of Canada (Communications Research Center Canada)
- Copyright (C) 2022
+ Copyright (C) 2024
Matthias P. Braendli, matthias.braendli@mpb.li
http://www.opendigitalradio.org
@@ -31,7 +31,7 @@
#include "ThreadsafeQueue.h"
#include <cstdlib>
#include <atomic>
-#include <iostream>
+#include <string>
#include <list>
#include <memory>
#include <thread>
@@ -118,7 +118,6 @@ class UDPSocket
void send(const std::vector<uint8_t>& data, InetAddress destination);
void send(const std::string& data, InetAddress destination);
UDPPacket receive(size_t max_size);
- void joinGroup(const char* groupname, const char* if_addr = nullptr);
void setMulticastSource(const char* source_addr);
void setMulticastTTL(int ttl);
@@ -130,9 +129,14 @@ class UDPSocket
SOCKET getNativeSocket() const;
int getPort() const;
+ private:
+ void join_group(const char* groupname, const char* if_addr = nullptr);
+ void post_init();
+
protected:
SOCKET m_sock = INVALID_SOCKET;
int m_port = 0;
+ std::string m_multicast_source = "";
};
/* UDP packet receiver supporting receiving from several ports at once */