annotate trunk/external/oscpack/examples/SimpleSend.cpp @ 706:f8e90b5d85fd tip

Delete CARFAC code from this repository. It has been moved to https://github.com/google/carfac Please email me with your github username to get access. I've also created a new mailing list to discuss CARFAC development: https://groups.google.com/forum/#!forum/carfac-dev
author ronw@google.com
date Thu, 18 Jul 2013 20:56:51 +0000
parents 4b37b53105a3
children
rev   line source
tomwalters@570 1 /*
tomwalters@570 2 Simple example of sending an OSC message using oscpack.
tomwalters@570 3 */
tomwalters@570 4
tomwalters@570 5 #include "osc/OscOutboundPacketStream.h"
tomwalters@570 6 #include "ip/UdpSocket.h"
tomwalters@570 7
tomwalters@570 8
tomwalters@570 9 #define ADDRESS "127.0.0.1"
tomwalters@570 10 #define PORT 7000
tomwalters@570 11
tomwalters@570 12 #define OUTPUT_BUFFER_SIZE 1024
tomwalters@570 13
tomwalters@570 14 int main(int argc, char* argv[])
tomwalters@570 15 {
tomwalters@570 16 UdpTransmitSocket transmitSocket( IpEndpointName( ADDRESS, PORT ) );
tomwalters@570 17
tomwalters@570 18 char buffer[OUTPUT_BUFFER_SIZE];
tomwalters@570 19 osc::OutboundPacketStream p( buffer, OUTPUT_BUFFER_SIZE );
tomwalters@570 20
tomwalters@570 21 p << osc::BeginBundleImmediate
tomwalters@570 22 << osc::BeginMessage( "/test1" )
tomwalters@570 23 << true << 23 << (float)3.1415 << "hello" << osc::EndMessage
tomwalters@570 24 << osc::BeginMessage( "/test2" )
tomwalters@570 25 << true << 24 << (float)10.8 << "world" << osc::EndMessage
tomwalters@570 26 << osc::EndBundle;
tomwalters@570 27
tomwalters@570 28 transmitSocket.Send( p.Data(), p.Size() );
tomwalters@570 29 }
tomwalters@570 30