|
| ACE_SOCK_Dgram_Mcast (options opts=DEFOPTS) |
|
| ~ACE_SOCK_Dgram_Mcast (void) |
|
int | open (const ACE_INET_Addr &mcast_addr, const ACE_TCHAR *net_if=0, int reuse_addr=1) |
|
int | join (const ACE_INET_Addr &mcast_addr, int reuse_addr=1, const ACE_TCHAR *net_if=0) |
|
int | leave (const ACE_INET_Addr &mcast_addr, const ACE_TCHAR *net_if=0) |
|
ssize_t | send (const void *buf, size_t n, int flags=0) const |
|
ssize_t | send (const iovec iov[], int n, int flags=0) const |
|
int | set_option (int option, char optval) |
| Set a socket option. More...
|
|
void | dump (void) const |
| Dump the state of an object. More...
|
|
void | opts (int opts) |
|
int | opts () const |
| Read acessor for the constructor options (. More...
|
|
| ACE_SOCK_Dgram (void) |
| Default constructor. More...
|
|
| ACE_SOCK_Dgram (const ACE_Addr &local, int protocol_family=ACE_PROTOCOL_FAMILY_INET, int protocol=0, int reuse_addr=0) |
|
| ACE_SOCK_Dgram (const ACE_Addr &local, int protocol_family, int protocol, ACE_Protocol_Info *protocolinfo, ACE_SOCK_GROUP g=0, u_long flags=0, int reuse_addr=0) |
|
int | open (const ACE_Addr &local, int protocol_family=ACE_PROTOCOL_FAMILY_INET, int protocol=0, int reuse_addr=0) |
|
int | open (const ACE_Addr &local, int protocol_family, int protocol, ACE_Protocol_Info *protocolinfo, ACE_SOCK_GROUP g=0, u_long flags=0, int reuse_addr=0) |
|
| ~ACE_SOCK_Dgram (void) |
| Default dtor. More...
|
|
ssize_t | send (const void *buf, size_t n, const ACE_Addr &addr, int flags=0) const |
| Send an n byte buf to the datagram socket (uses <sendto(3)>). More...
|
|
ssize_t | recv (void *buf, size_t n, ACE_Addr &addr, int flags=0) const |
|
ssize_t | recv (iovec *io_vec, ACE_Addr &addr, int flags=0, const ACE_Time_Value *timeout=0) const |
|
ssize_t | send (const iovec iov[], int n, const ACE_Addr &addr, int flags=0) const |
|
ssize_t | recv (iovec iov[], int n, ACE_Addr &addr, int flags=0) const |
|
ssize_t | recv (void *buf, size_t n, ACE_Addr &addr, int flags, const ACE_Time_Value *timeout) const |
|
ssize_t | send (const void *buf, size_t n, const ACE_Addr &addr, int flags, const ACE_Time_Value *timeout) const |
|
ssize_t | send (const iovec buffers[], int buffer_count, size_t &number_of_bytes_sent, int flags, const ACE_Addr &addr, ACE_OVERLAPPED *overlapped, ACE_OVERLAPPED_COMPLETION_FUNC func) const |
|
ssize_t | recv (iovec buffers[], int buffer_count, size_t &number_of_bytes_recvd, int &flags, ACE_Addr &addr, ACE_OVERLAPPED *overlapped, ACE_OVERLAPPED_COMPLETION_FUNC func) const |
|
ssize_t | send (const void *buf, size_t n, const ACE_Addr &addr, int flags, ACE_OVERLAPPED *overlapped, ACE_OVERLAPPED_COMPLETION_FUNC func) const |
| Send an n byte buf to the datagram socket (uses <WSASendTo>). More...
|
|
ssize_t | recv (void *buf, size_t n, ACE_Addr &addr, int flags, ACE_OVERLAPPED *overlapped, ACE_OVERLAPPED_COMPLETION_FUNC func) const |
|
void | dump (void) const |
| Dump the state of an object. More...
|
|
int | set_nic (const ACE_TCHAR *net_if, int addr_family=AF_UNSPEC) |
| Set NIC to use as multicast interface. More...
|
|
int | set_option (int level, int option, void *optval, int optlen) const |
| Wrapper around the setsockopt system call. More...
|
|
int | get_option (int level, int option, void *optval, int *optlen) const |
| Wrapper around the getsockopt system call. More...
|
|
int | close (void) |
|
int | get_local_addr (ACE_Addr &) const |
|
int | get_remote_addr (ACE_Addr &) const |
|
void | dump (void) const |
| Dump the state of an object. More...
|
|
int | open (int type, int protocol_family, int protocol, int reuse_addr) |
| Wrapper around the BSD-style socket system call (no QoS). More...
|
|
int | open (int type, int protocol_family, int protocol, ACE_Protocol_Info *protocolinfo, ACE_SOCK_GROUP g, u_long flags, int reuse_addr) |
| Wrapper around the QoS-enabled WSASocket function. More...
|
|
int | control (int cmd, void *) const |
| Interface for <ioctl>. More...
|
|
int | enable (int value) const |
|
int | disable (int value) const |
|
ACE_HANDLE | get_handle (void) const |
| Get the underlying handle. More...
|
|
void | set_handle (ACE_HANDLE handle) |
| Set the underlying handle. More...
|
|
void | dump (void) const |
| Dump the state of an object. More...
|
|
Defines the ACE socket wrapper for UDP/IP multicast.
Supports multiple simultaneous subscriptions, unsubscription from one or all subscriptions, and independent send/recv address and interface specifications. Constructor arguments determine per-instance optional functionality.
Note that multicast semantics and implementation details are very environment-specific; this class is just a wrapper around the underlying implementation and does not try to normalize the concept of multicast communications.
Usage Notes:
- Send and receive addresses and network interfaces, but not port number, are independent. While this instance is open, one send interface (and a default send address) is in effect and 0, 1, or multiple receive addresses/interfaces are in effect.
- The first open()/subscribe() invocation defines the network interface and default address used for all sends by this instance, defines the port number and optionally the multicast address bound to the underlying socket, and defines the (one) port number that is used for all subscribes (subsequent subscribes must pass the same port number or 0).
- The default loopback state is not explicitly set; the environment will determine the default state. Note that some environments (e.g. some Windows versions) do not allow the default to be changed, and that the semantics of loopback control are environment dependent (e.g. sender vs. receiver control).
- In general, due to multicast design and implementation quirks/bugs, it is difficult to tell which address a received message was sent to or which interface it was received on (even if only one subscription is active). However, there are filtering options that can be applied, to narrow it down considerably.
Interface specification notes (for subscribe() and unsubscribe()):
- If net_if == 0, the
OPT_NULLIFACE_ALL
and OPT_NULLIFACE_ONE
options determine whether only the system default interface (if OPT_NULLIFACE_ONE
is set) or all interfaces (if OPT_NULLIFACE_ALL
is set) is affected. Specifying all interfaces functions correctly only on:
- Windows
- Platforms with the ACE_HAS_GETIFADDRS config setting (includes Linux)
- Platforms which accept the IP address as an interface name/specification
- Systems with only one non-loopback interface. Other platforms require additional supporting code.
- Multiple subscriptions for the same address but different interfaces is normally supported, but re-subscription to an address/interface that is already subscribed is normally not allowed.
- The net_if interface specification syntax is environment-specific. UNIX systems will normally use device specifications such as "le0" or "elxl1", while other systems will use the IP address of the interface. Some platforms, such as pSoS, support only cardinal numbers as network interface specifications; for these platforms, just give these numbers in string form and join() will convert them into numbers.
int ACE_SOCK_Dgram_Mcast::join |
( |
const ACE_INET_Addr & |
mcast_addr, |
|
|
int |
reuse_addr = 1 , |
|
|
const ACE_TCHAR * |
net_if = 0 |
|
) |
| |
Join a multicast group on a given interface (or all interfaces, if supported). The given group is joined on the specified interface. If option OPT_NULLIFACE_ALL is used and net_if is = 0, the group is joined on all multicast capable interfaces (IFF supported). Multiple subscriptions to various address and interface combinations are supported and tracked. If this is the first invocation of subscribe(), and open() was not previously invoked, open() will be invoked using mcast_addr for binding the socket and net_if as the interface for send().
Returns: -1 if the call fails. Failure can occur due to problems with the address, port#, and/or interface parameters or during the subscription attempt. Once bind() has been invoked (by the first open() or subscribe()), returns errno of ENXIO if the port# is not 0 and does not match the bound port#, or if OPT_BINDADDR_YES option is used and the address does not match the bound address. Returns errno of ENODEV if the addr/port#/interface parameters appeared valid, but no subscription(s) succeeded. An error is unconditionally returned if option OPT_NULLIFACE_ALL is used, net_if is NULL, and ACE_Sock_Connect::get_ip_interfaces() is not implemented in this environment.
Note that the optional reuse_addr parameter does not apply to subscriptions; it is only used if open() is implicitly invoked (see above).
Uses the mcast_addr to determine protocol_family, and protocol which we always pass as 0 anyway.