annotate resources/osc/node_modules/osc-min/examples/printosc.coffee @ 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 osc = require 'osc-min'
l@271 2 udp = require "dgram"
l@271 3
l@271 4 if process.argv[2]?
l@271 5 inport = parseInt process.argv[2]
l@271 6 else
l@271 7 inport = 41234
l@271 8
l@271 9 console.log "OSC listener running at http://localhost:" + inport
l@271 10
l@271 11 `//~verbatim:examples[0]~
l@271 12 //### A simple OSC printer`
l@271 13 sock = udp.createSocket "udp4", (msg, rinfo) ->
l@271 14 try
l@271 15 console.log osc.fromBuffer msg
l@271 16 catch error
l@271 17 console.log "invalid OSC packet"
l@271 18 sock.bind inport