#include <ace/SOCK_Dgram_Mcast.h>
class ACE_SOCK_Dgram_Mcast : public ACE_SOCK_Dgram {
public:
ACE_SOCK_Dgram_Mcast (void);
~ACE_SOCK_Dgram_Mcast (void);
int subscribe ( const ACE_INET_Addr &mcast_addr, int reuse_addr = 1, long net_if = 0, const ASYS_TCHAR *net_if = 0, int protocol_family = PF_INET, int protocol = 0 );
int unsubscribe ( const ACE_INET_Addr &mcast_addr, long net_if = 0, const ASYS_TCHAR *net_if = 0, int protocol_family = PF_INET, int protocol = 0 );
int unsubscribe (void);
ssize_t send (const void *buf, size_t n, int flags = 0) const;
ssize_t send (const iovec iov[], size_t n, int flags = 0) const;
int set_option (int option, char optval);
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
private:
ACE_HANDLE open ( const ACE_Addr &local, int protocol_family = PF_INET, int protocol = 0 );
ssize_t send ( const void *buf, size_t n, const ACE_Addr &addr, int flags = 0 ) const;
ssize_t send ( const iovec iov[], size_t n, const ACE_Addr &addr, int flags = 0 ) const;
inline int make_multicast_address ( const ACE_INET_Addr &mcast_addr, long net_if = 0 const ASYS_TCHAR *net_if = ASYS_TEXT ("le0" );
inline int make_multicast_address_i ( const ACE_INET_Addr &mcast_addr, ip_mreq& multicast_address, long net_if = 0 const ASYS_TCHAR *net_if = ASYS_TEXT ("le0" );
ACE_INET_Addr mcast_addr_;
ip_mreq multicast_address_;
};
ACE_SOCK_Dgram_Mcast (void);
open
. This cannot be used unless you
subscribe to the multicast group. If you just want to send (and
not listen) to the multicast group, use ACE_SOCK_Dgram or
ACE_SOCK_CODgram.
~ACE_SOCK_Dgram_Mcast (void);
int subscribe (
const ACE_INET_Addr &mcast_addr,
int reuse_addr = 1,
long net_if = 0,
const ASYS_TCHAR *net_if = 0,
int protocol_family = PF_INET,
int protocol = 0
);
If you have called open already, subscribe closes the socket and opens a new socket bound to the mcast_addr.
Interface is hardware specific. use netstat -i to find whether your interface is, say, le0 or something else. If net_if == 0, subscribe uses the default mcast interface. Returns: -1 on error, else 0.
int unsubscribe (
const ACE_INET_Addr &mcast_addr,
long net_if = 0,
const ASYS_TCHAR *net_if = 0,
int protocol_family = PF_INET,
int protocol = 0
);
Interface is hardware specific. use netstat -i to find whether your interface is, say, le0 or something else. If net_if == 0, subscribe uses the default mcast interface. Returns: -1 on error, else 0.
int unsubscribe (void);
ssize_t send (const void *buf, size_t n, int flags = 0) const;
n
bytes in buf
.
ssize_t send (const iovec iov[], size_t n, int flags = 0) const;
n
iovecs
.
int set_option (int option, char optval);
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
ssize_t send (
const void *buf,
size_t n,
const ACE_Addr &addr,
int flags = 0
) const;
ssize_t send (
const iovec iov[],
size_t n,
const ACE_Addr &addr,
int flags = 0
) const;
inline int make_multicast_address (
const ACE_INET_Addr &mcast_addr,
long net_if = 0 const ASYS_TCHAR *net_if = ASYS_TEXT ("le0"
);
multicast_addres_ field
inline int make_multicast_address_i (
const ACE_INET_Addr &mcast_addr,
ip_mreq& multicast_address,
long net_if = 0 const ASYS_TCHAR *net_if = ASYS_TEXT ("le0"
);
ACE_INET_Addr mcast_addr_;
ip_mreq multicast_address_;