diff --git a/examples/pub/main.cpp b/examples/pub/main.cpp index 9c181de..edb970f 100644 --- a/examples/pub/main.cpp +++ b/examples/pub/main.cpp @@ -83,14 +83,18 @@ int main( int argc, char* argv[] ) // Assume we are connected now, start publishing. while( 1 ) { - std::string payload = "" ; - pPublisher->publish( std::string( "test/publisher/TestPublisher" ), payload ); - + for( unsigned int nCount = 0; nCount < 10; nCount++ ) + { + std::string payload = "" ; + pPublisher->publish( std::string( "test/publisher/TestPublisher_" + std::to_string( nCount ) ), payload ); + + if( messageNumber > 2000000000 ) + { + messageNumber = -1; + } + messageNumber++; + } sleepcp( 1, T_MICRO ); - if( messageNumber > 2000000000 ) - messageNumber = -1; - - messageNumber++; } } else diff --git a/examples/sub/main.cpp b/examples/sub/main.cpp index 57e365c..0699e74 100644 --- a/examples/sub/main.cpp +++ b/examples/sub/main.cpp @@ -78,12 +78,12 @@ int main( int argc, char* argv[] ) std::cout << "Connecting to the test-broker : " << std::endl; pSubscriber->connect( "office.osdev.nl", 1883, "", "" ); std::cout << "Subscribing to the test-topic....." << std::endl; - pSubscriber->subscribe( "test/publisher/TestPublisher" ); + pSubscriber->subscribe( "test/publisher/#" ); // Start a loop to give the subscriber the possibility to do its work. while( 1 ) { - sleepcp( 1, T_SECONDS ); // Sleep 1 Sec to give the scheduler the change to interfene. + sleepcp( 1, T_MICRO ); // Sleep 1 Sec to give the scheduler the change to interfene. } } else