diff options
author | Steve Huston <shuston@riverace.com> | 2012-03-22 16:38:18 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2012-03-22 16:38:18 +0000 |
commit | 4b7af7f078eb2cdacaef58cbbc783171e4438a10 (patch) | |
tree | 5c2f807380808b96d93d507f370db246a90945a9 /ACE/tests/Multicast_Test.cpp | |
parent | ee2c49aceec8febe0d08830ecf43e9f65614300e (diff) | |
download | ATCD-4b7af7f078eb2cdacaef58cbbc783171e4438a10.tar.gz |
ChangeLogTag:Thu Mar 22 16:23:14 UTC 2012 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'ACE/tests/Multicast_Test.cpp')
-rw-r--r-- | ACE/tests/Multicast_Test.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ACE/tests/Multicast_Test.cpp b/ACE/tests/Multicast_Test.cpp index 02a7332a156..ebc9ae339d2 100644 --- a/ACE/tests/Multicast_Test.cpp +++ b/ACE/tests/Multicast_Test.cpp @@ -460,6 +460,9 @@ public: virtual ACE_HANDLE get_handle (void) const; + // Turn loopback on/off. Must be called after at least 1 join() is performed. + int loopback (bool on_off); + protected: ACE_SOCK_Dgram_Mcast *mcast (void); int find (const char *buf); @@ -633,6 +636,14 @@ MCT_Event_Handler::get_handle (void) const return this->mcast_.get_handle (); } +// Turn loopback on/off +int +MCT_Event_Handler::loopback (bool on_off) +{ + char loopback_on = on_off ? 1 : 0; + return this->mcast_.set_option (IP_MULTICAST_LOOP, loopback_on); +} + /******************************************************************************/ /* @@ -713,6 +724,13 @@ MCT_Task::open (void *) advance_addr (addr); + // This test needs loopback because we're both sending and receiving. + // Loopback is usually the default, but be sure. + if (-1 == handler->loopback (true)) + ACE_ERROR ((LM_WARNING, + ACE_TEXT ("%p\n"), + ACE_TEXT ("MCT_Task::open - enable loopback"))); + if (this->reactor ()->register_handler (handler, READ_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("MCT_Task::open - cannot register ") |