summaryrefslogtreecommitdiff
path: root/ace/SOCK_Dgram_Mcast.cpp
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-03-13 03:47:44 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-03-13 03:47:44 +0000
commit7981fefc95815d3343758242fb3ce869a4e437a5 (patch)
tree697380da04843973af44d4e419e2f04bba8e0acd /ace/SOCK_Dgram_Mcast.cpp
parent1b0db70e98273eeb6ce2161b6546857def05bf79 (diff)
downloadATCD-7981fefc95815d3343758242fb3ce869a4e437a5.tar.gz
*** empty log message ***
Diffstat (limited to 'ace/SOCK_Dgram_Mcast.cpp')
-rw-r--r--ace/SOCK_Dgram_Mcast.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/ace/SOCK_Dgram_Mcast.cpp b/ace/SOCK_Dgram_Mcast.cpp
index 2950fbcd565..559f65ab63f 100644
--- a/ace/SOCK_Dgram_Mcast.cpp
+++ b/ace/SOCK_Dgram_Mcast.cpp
@@ -40,7 +40,7 @@ ACE_SOCK_Dgram_Mcast::subscribe (const ACE_INET_Addr &mcast_addr,
// Create multicast request.
if (this->make_multicast_address (this->mcast_addr_, net_if) == -1)
return -1;
-
+
int one = 1;
if (reuse_addr
&& this->ACE_SOCK::set_option (SOL_SOCKET,
@@ -48,11 +48,11 @@ ACE_SOCK_Dgram_Mcast::subscribe (const ACE_INET_Addr &mcast_addr,
&one,
sizeof one) == -1)
return -1;
-
+
// Create an address to bind the socket to.
-
+
ACE_INET_Addr local;
-
+
if (local.set (this->mcast_addr_.get_port_number ()) == -1)
return -1;
else if (ACE_SOCK_Dgram::shared_open (local, protocol_family) == -1)
@@ -84,9 +84,9 @@ ACE_SOCK_Dgram_Mcast::make_multicast_address (const ACE_INET_Addr &mcast_addr,
{
ACE_TRACE ("ACE_SOCK_Dgram_Mcast::make_multicast_address");
-#if !defined (ACE_WIN32)
if (net_if != 0)
{
+#if !defined (ACE_WIN32)
struct ifreq if_address;
ACE_OS::strcpy (if_address.ifr_name, net_if);
@@ -97,15 +97,19 @@ ACE_SOCK_Dgram_Mcast::make_multicast_address (const ACE_INET_Addr &mcast_addr,
struct sockaddr_in *socket_address;
socket_address = (sockaddr_in *) &if_address.ifr_addr;
multicast_address_.imr_interface.s_addr = socket_address->sin_addr.s_addr;
+#else
+ // This port number is not necessary, just convenient
+ ACE_INET_Addr interface_addr;
+ if (interface_addr.set (mcast_addr.get_port_number (),
+ net_if) == -1)
+ return -1;
+ multicast_address_.imr_interface.s_addr = htonl (interface_addr.get_ip_address ());
+#endif /* ACE_WIN32 */
}
else
-#else
- ACE_UNUSED_ARG (net_if);
-#endif /* ACE_WIN32 */
- multicast_address_.imr_interface.s_addr = INADDR_ANY;
-
+ multicast_address_.imr_interface.s_addr = INADDR_ANY;
+
multicast_address_.imr_multiaddr.s_addr = htonl (mcast_addr.get_ip_address ());
- // multicast_address_.imr_multiaddr.s_addr = mcast_addr.get_ip_address ();
return 0;
}
#endif /* ACE_HAS_IP_MULTICAST */