Boost logo

Boost-Commit :

From: chris_at_[hidden]
Date: 2007-11-26 16:29:38


Author: chris_kohlhoff
Date: 2007-11-26 16:29:38 EST (Mon, 26 Nov 2007)
New Revision: 41407
URL: http://svn.boost.org/trac/boost/changeset/41407

Log:
WinCE doesn't work with all multicast addresses, and even though it doesn't
support the multicast::enable_loopback option you can still get the value.

Text files modified:
   trunk/libs/asio/test/ip/multicast.cpp | 20 +++++++++++++-------
   1 files changed, 13 insertions(+), 7 deletions(-)

Modified: trunk/libs/asio/test/ip/multicast.cpp
==============================================================================
--- trunk/libs/asio/test/ip/multicast.cpp (original)
+++ trunk/libs/asio/test/ip/multicast.cpp 2007-11-26 16:29:38 EST (Mon, 26 Nov 2007)
@@ -106,7 +106,7 @@
 
 #if defined(__hpux)
 // HP-UX doesn't declare this function extern "C", so it is declared again here
-// to avoid a linker errors about an undefined symbol.
+// to avoid a linker error about an undefined symbol.
 extern "C" unsigned int if_nametoindex(const char*);
 #endif // defined(__hpux)
 
@@ -132,8 +132,16 @@
 
   BOOST_CHECK(have_v4 || have_v6);
 
+#if defined(BOOST_WINDOWS) && defined(UNDER_CE)
+ // Windows CE seems to have problems with some multicast group addresses.
+ // The following address works on CE, but as it is not a private multicast
+ // address it will not be used on other platforms.
+ const ip::address multicast_address_v4 =
+ ip::address::from_string("239.0.0.4", ec);
+#else // defined(BOOST_WINDOWS) && defined(UNDER_CE)
   const ip::address multicast_address_v4 =
     ip::address::from_string("239.255.0.1", ec);
+#endif // defined(BOOST_WINDOWS) && defined(UNDER_CE)
   BOOST_CHECK(!have_v4 || !ec);
 
   const ip::address multicast_address_v6 =
@@ -261,9 +269,8 @@
     ip::multicast::enable_loopback enable_loopback2;
     sock_v4.get_option(enable_loopback2, ec);
 #if defined(BOOST_WINDOWS) && defined(UNDER_CE)
- // Option is not supported under Windows CE.
- BOOST_CHECK_MESSAGE(ec == boost::asio::error::no_protocol_option,
- ec.value() << ", " << ec.message());
+ // Not supported under Windows CE but can get value.
+ BOOST_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
 #else // defined(BOOST_WINDOWS) && defined(UNDER_CE)
     BOOST_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
     BOOST_CHECK(enable_loopback2.value());
@@ -287,9 +294,8 @@
     ip::multicast::enable_loopback enable_loopback4;
     sock_v4.get_option(enable_loopback4, ec);
 #if defined(BOOST_WINDOWS) && defined(UNDER_CE)
- // Option is not supported under Windows CE.
- BOOST_CHECK_MESSAGE(ec == boost::asio::error::no_protocol_option,
- ec.value() << ", " << ec.message());
+ // Not supported under Windows CE but can get value.
+ BOOST_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
 #else // defined(BOOST_WINDOWS) && defined(UNDER_CE)
     BOOST_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
     BOOST_CHECK(!enable_loopback4.value());


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk