Changeset 14

Show
Ignore:
Timestamp:
09/22/05 12:01:36 (3 years ago)
Author:
ross
Message:

added OscReceiveTest?.h and factored out test function so it can be called externally

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • oscpack/trunk/osc/OscReceiveTest.cpp

    r5 r14  
    2828  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
    2929*/ 
     30#include "OscReceiveTest.h" 
     31 
    3032#include <string.h> 
    3133#include <iostream> 
     
    219221}; 
    220222 
     223 
     224void RunReceiveTest( int port ) 
     225{ 
     226    osc::OscReceiveTestPacketListener listener; 
     227  UdpReceiveSocket s( IpEndpointName( IpEndpointName::ANY_ADDRESS, port ) ); 
     228  SocketReceiveMultiplexer mux; 
     229  mux.AttachSocketListener( &s, &listener ); 
     230 
     231  std::cout << "listening for input on port " << port << "...\n"; 
     232  std::cout << "press ctrl-c to end\n"; 
     233 
     234  mux.RunUntilSigInt(); 
     235 
     236  std::cout << "finishing.\n"; 
     237} 
     238 
    221239} // namespace osc 
    222240 
     241#ifndef NO_OSC_TEST_MAIN 
    223242 
    224243int main(int argc, char* argv[]) 
     
    234253    port = atoi( argv[1] ); 
    235254 
    236   osc::OscReceiveTestPacketListener listener; 
    237   UdpReceiveSocket s( IpEndpointName( IpEndpointName::ANY_ADDRESS, port ) ); 
    238   SocketReceiveMultiplexer mux; 
    239   mux.AttachSocketListener( &s, &listener ); 
    240  
    241   std::cout << "listening for input on port " << port << "...\n"; 
    242   std::cout << "press ctrl-c to end\n"; 
    243  
    244   mux.RunUntilSigInt(); 
    245  
    246   std::cout << "finishing.\n"; 
     255    osc::RunReceiveTest( port ); 
    247256 
    248257    return 0; 
    249258} 
    250259 
     260#endif /* NO_OSC_TEST_MAIN */