Merge branch 'master' of https://scm.cri.ensmp.fr/git/Faustine
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / architecture / osclib / oscpack / examples / SimpleSend.cpp
1 /*
2 Simple example of sending an OSC message using oscpack.
3 */
4
5 #include "osc/OscOutboundPacketStream.h"
6 #include "ip/UdpSocket.h"
7
8
9 #define ADDRESS "127.0.0.1"
10 #define PORT 7000
11
12 #define OUTPUT_BUFFER_SIZE 1024
13
14 int main(int argc, char* argv[])
15 {
16 UdpTransmitSocket transmitSocket( IpEndpointName( ADDRESS, PORT ) );
17
18 char buffer[OUTPUT_BUFFER_SIZE];
19 osc::OutboundPacketStream p( buffer, OUTPUT_BUFFER_SIZE );
20
21 p << osc::BeginBundleImmediate
22 << osc::BeginMessage( "/test1" )
23 << true << 23 << (float)3.1415 << "hello" << osc::EndMessage
24 << osc::BeginMessage( "/test2" )
25 << true << 24 << (float)10.8 << "world" << osc::EndMessage
26 << osc::EndBundle;
27
28 transmitSocket.Send( p.Data(), p.Size() );
29 }
30