From 56632c4b32abc705f613475c3b78ae7a5dd4a3d2 Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 13 Oct 2005 09:08:32 +0000 Subject: *** empty log message *** --- src/multicast.cc | 37 ++++--------------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) (limited to 'src/multicast.cc') diff --git a/src/multicast.cc b/src/multicast.cc index 80be2ce..34c7241 100644 --- a/src/multicast.cc +++ b/src/multicast.cc @@ -35,22 +35,6 @@ Multicast::Multicast(Info *i, char *addr, int port) { - /* - Multicast adresses: - 224.0.0.1 All systems on this subnet - 224.0.0.2 All routers on this subnet - 224.0.0.5 OSPF routers - 224.0.0.6 OSPF designated routers - 224.0.0.12 DHCP server/relay agent -server_multicast = true -server_multicast_addr = "224.0.0.1" -server_multicast_port = 1234 - */ - - // Multicast to all systems on this subnet - // char addr[] = "224.0.0.1"; - // int port = 1234; - info = i; if(!UDPOpen(addr, port)) info->error("Error creating socket %s:%d", addr, port); } @@ -61,17 +45,9 @@ Multicast::~Multicast() void Multicast::Write(void* buf, int size) { - // char addr[] = "192.168.0.10"; - // int port = 1234; - - if(write(sock, buf, size) != size) { - info->error("Error Writing to socket."); - // if(!UDPOpen(addr, port)) info->error("Error creating socket %s:%d", addr, port); - } + if(write(sock, buf, size) != size) info->error("Error Writing to socket."); } -#define USE_MULTICAST - bool Multicast::is_address_multicast(unsigned long address) { if((address & 255) >= 224 && (address & 255) <= 239) { @@ -106,12 +82,10 @@ bool Multicast::UDPOpen(char *address, int port) if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *) &enable, sizeof(unsigned long int)) < 0) return false; -#ifdef USE_MULTICAST // If the address is multicast, register to the multicast group - if(is_address_multicast(stAddr.sin_addr.s_addr)) - { + if(is_address_multicast(stAddr.sin_addr.s_addr)) { struct ip_mreq stMreq; - + // Bind the socket to port stLclAddr.sin_family = AF_INET; stLclAddr.sin_addr.s_addr = htonl(INADDR_ANY); @@ -123,10 +97,7 @@ bool Multicast::UDPOpen(char *address, int port) stMreq.imr_interface.s_addr = INADDR_ANY; if(setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *) & stMreq, sizeof(stMreq)) < 0) return false; - } - else -#endif - { + } else { // Bind the socket to port stLclAddr.sin_family = AF_INET; stLclAddr.sin_addr.s_addr = htonl(INADDR_ANY); -- cgit v1.2.3