annotate external/oscpack/examples/SimpleSend.cpp @ 609:aefe2ca0674f

First version of a C++ implementation by Alex Brandmeyer
author alexbrandmeyer
date Mon, 13 May 2013 22:51:15 +0000
parents 0284d2152e17
children
rev   line source
tomwalters@509 1 /*
tomwalters@509 2 Simple example of sending an OSC message using oscpack.
tomwalters@509 3 */
tomwalters@509 4
tomwalters@509 5 #include "osc/OscOutboundPacketStream.h"
tomwalters@509 6 #include "ip/UdpSocket.h"
tomwalters@509 7
tomwalters@509 8
tomwalters@509 9 #define ADDRESS "127.0.0.1"
tomwalters@509 10 #define PORT 7000
tomwalters@509 11
tomwalters@509 12 #define OUTPUT_BUFFER_SIZE 1024
tomwalters@509 13
tomwalters@509 14 int main(int argc, char* argv[])
tomwalters@509 15 {
tomwalters@509 16 UdpTransmitSocket transmitSocket( IpEndpointName( ADDRESS, PORT ) );
tomwalters@509 17
tomwalters@509 18 char buffer[OUTPUT_BUFFER_SIZE];
tomwalters@509 19 osc::OutboundPacketStream p( buffer, OUTPUT_BUFFER_SIZE );
tomwalters@509 20
tomwalters@509 21 p << osc::BeginBundleImmediate
tomwalters@509 22 << osc::BeginMessage( "/test1" )
tomwalters@509 23 << true << 23 << (float)3.1415 << "hello" << osc::EndMessage
tomwalters@509 24 << osc::BeginMessage( "/test2" )
tomwalters@509 25 << true << 24 << (float)10.8 << "world" << osc::EndMessage
tomwalters@509 26 << osc::EndBundle;
tomwalters@509 27
tomwalters@509 28 transmitSocket.Send( p.Data(), p.Size() );
tomwalters@509 29 }
tomwalters@509 30