// // Copyright @ 2015 Hangzhou Topzen Ltd. // Author: Wu JiuBao (wujb@hztopzen.com) @ 2017-03 // #ifndef __MULTICASTSOCKET_H #define __MULTICASTSOCKET_H #include "UDPSocket.h" namespace tzc { class DECLDLL MulticastSocket : public UDPSocket { public: MulticastSocket(); MulticastSocket(const Socket & sock); virtual ~MulticastSocket(); public: // join to multicast group TZ_INT Join2MCGroup(const std::string & ip, const std::string & localip = ""); // leave from multicast goup TZ_INT LeaveFromMCGroup(const std::string & ip); // get multicast ip address std::string GetMulticastAddr(); // set multicast whether loop-back TZ_INT SetMulticastLoop(TZ_BOOL on); TZ_BOOL GetMulticastLoop(); // set data-packet's ttl of multicast, // the default value is 1, means the data-packets // can be transmitted just in the subnet. TZ_INT SetMulticastTTL(TZ_Uint8 ttl); TZ_Uint8 GetMulticastTTL(); // set network interface of multicast TZ_INT SetMulticastIF(const std::string & ip); std::string GetMulticastIF(); }; }; // namespace tzc #endif /*-----#ifndef __MULTICASTSOCKET_H-----*/