comparison resources/osc/node_modules/osc-min/examples/printosc.js @ 271:fb9c28a4676b prerelease

Added osc example project and node script for testing
author Liam Donovan <l.b.donovan@qmul.ac.uk>
date Tue, 17 May 2016 16:01:06 +0100
parents
children
comparison
equal deleted inserted replaced
270:de37582ce6f3 271:fb9c28a4676b
1 // Generated by CoffeeScript 1.10.0
2 var inport, osc, sock, udp;
3
4 osc = require('osc-min');
5
6 udp = require("dgram");
7
8 if (process.argv[2] != null) {
9 inport = parseInt(process.argv[2]);
10 } else {
11 inport = 41234;
12 }
13
14 console.log("OSC listener running at http://localhost:" + inport);
15
16 //~verbatim:examples[0]~
17 //### A simple OSC printer;
18
19 sock = udp.createSocket("udp4", function(msg, rinfo) {
20 var error, error1;
21 try {
22 return console.log(osc.fromBuffer(msg));
23 } catch (error1) {
24 error = error1;
25 return console.log("invalid OSC packet");
26 }
27 });
28
29 sock.bind(inport);