annotate 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
rev   line source
l@271 1 // Generated by CoffeeScript 1.10.0
l@271 2 var inport, osc, sock, udp;
l@271 3
l@271 4 osc = require('osc-min');
l@271 5
l@271 6 udp = require("dgram");
l@271 7
l@271 8 if (process.argv[2] != null) {
l@271 9 inport = parseInt(process.argv[2]);
l@271 10 } else {
l@271 11 inport = 41234;
l@271 12 }
l@271 13
l@271 14 console.log("OSC listener running at http://localhost:" + inport);
l@271 15
l@271 16 //~verbatim:examples[0]~
l@271 17 //### A simple OSC printer;
l@271 18
l@271 19 sock = udp.createSocket("udp4", function(msg, rinfo) {
l@271 20 var error, error1;
l@271 21 try {
l@271 22 return console.log(osc.fromBuffer(msg));
l@271 23 } catch (error1) {
l@271 24 error = error1;
l@271 25 return console.log("invalid OSC packet");
l@271 26 }
l@271 27 });
l@271 28
l@271 29 sock.bind(inport);