Frage
I installed Node.js and integrated Socket.io.
In a file called "appudp.js", I have the following code:
var dgram = require('dgram');
var message = new Buffer("5656"); // Whatever the number could be...
var client = dgram.createSocket("udp4");
client.on("error", function (err) {
console.log("Socket error: " + err);
});
// At every second, send a message...
setInterval(function(){
client.send(message, 0, message.length, 1337, "127.0.0.1", function(err, bytes) {
console.log("err : " + err + " | bytes : " + bytes + " | Message : " + message);
});
}, 1000);
I go in command prompt, type "node app.js". I get at every 1000 ms:
err: null | bytes: 4 | Message: 5656
All good so far.
In MaxMsp, I have this very simple patch:
Yet, as you can see in the screen capture, it gives me the error :
OSC Bad message name string: DataAfterAlignedString: Unreasonably long string Dropping entire message.
Being somewhat new to MaxMsp, I end up being completely lost. Help?
Lösung
It looks like you are not sending OSC, but arbitrary UDP packets. Note that the udpreceive object expects OSC-formatted packets, as generalhenry suggests.
To format messages as OSC, you could use a library like https://github.com/termie/node-osc.