summaryrefslogtreecommitdiff
path: root/src/multicast.cc
diff options
context:
space:
mode:
authordeva <deva>2005-10-27 14:08:28 +0000
committerdeva <deva>2005-10-27 14:08:28 +0000
commit971d1fdf8599dccdc604ed9374373af16af8354f (patch)
treeac8430951bb676cbf501702cff4450a555afe394 /src/multicast.cc
parent283599ea687e81855d78abffcbf641edb3bf02fb (diff)
*** empty log message ***
Diffstat (limited to 'src/multicast.cc')
-rw-r--r--src/multicast.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/multicast.cc b/src/multicast.cc
index ff3f557..0072c19 100644
--- a/src/multicast.cc
+++ b/src/multicast.cc
@@ -27,6 +27,8 @@
#include "config.h"
#include "multicast.h"
+#include "multicast_configuration.h"
+
#include "miav_config.h"
#include <sys/socket.h>
@@ -44,13 +46,18 @@
#include <errno.h>
-Multicast::Multicast(Info *i, char *addr, int port)
+Multicast::Multicast(Info *i, mcastconf_t &mcclientconf)
{
info = i;
udp_buffer = NULL;
-
+
+ multicast_audio = mcclientconf.with_audio;
+
// Open connection socket
- if(!UDPOpen(addr, port)) info->error("Error creating socket %s:%d", addr, port);
+ if(!UDPOpen(mcclientconf.addr.c_str(), mcclientconf.port))
+ info->error("Error creating socket %s:%d",
+ mcclientconf.addr.c_str(),
+ mcclientconf.port);
int mtu = config->readInt("udp_packet_size");
@@ -75,9 +82,9 @@ Multicast::~Multicast()
if(udp_buffer) delete udp_buffer;
}
-void Multicast::Write(void* buf, int size)
+int Multicast::Write(void* buf, int size)
{
- if(!udp_buffer) return; // no buffer to write in... better break out!
+ if(!udp_buffer) return 0; // no buffer to write in... better break out!
// info->info("To send: %d", size);
@@ -104,6 +111,7 @@ void Multicast::Write(void* buf, int size)
udp_buffer_pointer = udp_buffer;
}
}
+ return size;
}
bool Multicast::is_address_multicast(unsigned long address)
@@ -119,7 +127,7 @@ bool Multicast::is_address_multicast(unsigned long address)
/*
* open UDP socket
*/
-bool Multicast::UDPOpen(char *address, int port)
+bool Multicast::UDPOpen(const char *address, int port)
{
int enable = 1L;
struct sockaddr_in stAddr;