<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: Node.JS to OSC via UDP</title>
		<atom:link href="http://cycling74.com/forums/topic/node-js-to-osc-via-udp/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/feed</link>
		<description></description>
		<pubDate>Wed, 19 Jun 2013 09:19:44 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-64276</guid>
					<title><![CDATA[Node.JS to OSC via UDP]]></title>
					<link>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-64276</link>
					<pubDate>Sun, 16 Sep 2012 16:37:42 +0000</pubDate>
					<dc:creator>Justin</dc:creator>

					<description>
						<![CDATA[
						<p>This is driving me nuts!</p>
<p>I installed <a href="http://nodejs.org/">Node.js</a> and integrated <a href="http://socket.io/">Socket.io</a>.</p>
<p>In a file called &#8220;appudp.js&#8221;, I have the following code:</p>
<pre><code>var dgram = require(&#39;dgram&#39;);

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);</code></pre><p>I go in command prompt, type &#8220;node app.js&#8221;. I get:</p>
<blockquote><p>
err: null | bytes: 4 | Message: 5656</p>
</blockquote>
<p>All good so far.</p>
<p>In MaxMsp, I have this very simple patch: <a href="http://i.imgur.com/FQrvO.png" rel="nofollow">http://i.imgur.com/FQrvO.png</a> </p>
<p>Yet, as you can see in the screen capture, it gives me the error :</p>
<blockquote><p>
OSC Bad message name string: DataAfterAlignedString: Unreasonably long string Dropping entire message.</p>
</blockquote>
<p>Being somewhat new to MaxMsp, I end up being completely lost. Help?</p>
<p>I&#8217;m thinking it has to do with the content of the <a href="http://nodejs.org/api/buffer.html#buffer_buffer">Buffer object</a> (has to be an integer?) and the encoding (ascii?), but I&#8217;m not completely sure.</p>
<p>Thank you very much for your time!</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231766</guid>
					<title><![CDATA[Re: Node.JS to OSC via UDP]]></title>
					<link>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231766</link>
					<pubDate>Mon, 17 Sep 2012 21:51:22 +0000</pubDate>
					<dc:creator>Joshua Kit Clayton</dc:creator>

					<description>
						<![CDATA[
						<p>Check out the following projects that Florian Demmer made for demonstrating how to use node.js together with Max, and then passing on to a web browser:</p>
<p><a href="https://github.com/fde31/node-MaxComm" rel="nofollow">https://github.com/fde31/node-MaxComm</a></p>
<p><a href="https://github.com/fde31/MaxClientJS" rel="nofollow">https://github.com/fde31/MaxClientJS</a></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231767</guid>
					<title><![CDATA[Re: Node.JS to OSC via UDP]]></title>
					<link>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231767</link>
					<pubDate>Wed, 19 Sep 2012 20:33:45 +0000</pubDate>
					<dc:creator>rjungemann</dc:creator>

					<description>
						<![CDATA[
						<p>I recommend taking a look at the mxj objects net.tcp.recv, net.tcp.send, net.udp.recv, and net.udp.send. Attached is an example using the net.tcp object to send messages to/from node.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231768</guid>
					<title><![CDATA[Re: Node.JS to OSC via UDP]]></title>
					<link>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231768</link>
					<pubDate>Thu, 20 Sep 2012 15:50:13 +0000</pubDate>
					<dc:creator>Justin</dc:creator>

					<description>
						<![CDATA[
						<p>Thank you very much rjungemann. I looked into the source files and the server communication worked.</p>
<p>I was now wondering if it was ever possible to send a TCP message from a local webpage? I thought the code under &#8220;// this client only sends&#8221; would enable me to do so, but it doesn&#8217;t seem to be the case. In fact, nothing in this section seems to be executed when I log on the page 127.0.0.1:6001 or 6000.</p>
<p>Is it because I&#8217;m misunderstanding the principles of TCP?</p>
<p>Thank you again.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231769</guid>
					<title><![CDATA[Re: Node.JS to OSC via UDP]]></title>
					<link>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231769</link>
					<pubDate>Fri, 21 Sep 2012 18:39:11 +0000</pubDate>
					<dc:creator>rjungemann</dc:creator>

					<description>
						<![CDATA[
						<p>If you want to be able to visit a webpage and send messages, you will need to have some sort of client (such as websockets) running in the browser, which would communicate with a server in Node JS. From there, Node JS will have to connect to Max MSP. The reason for this is that the browser is in a security sandbox and is not able to act as a server. You&#8217;ll need to have a middleman that sits and waits for messages from the browser and forward them on.</p>
<p>Browsers cannot communicate natively over raw TCP. HTTP uses TCP but you can&#8217;t script the browser to communicate over raw TCP. You&#8217;ll have to use something like Socket.IO, websockets, long polling, or just HTTP requests (easy but slow).</p>
<p>TCP is just a generic way for sending messages between a client and a server. Web servers do use TCP to send messages from the browser to the server, but just because something uses TCP doesn&#8217;t mean it will automatically work in the browser.</p>
<p>Here is a diagram of a possible implementation:</p>
<p><code>Browser to Max: Browser (running Socket.IO client) ---> Node JS (Socket.IO server) ---> Node JS (TCP client) ---> Max MSP (mxj net.tcp.recv)</code></p>
<p><code>Max to Browser: Max MSP (mxj net.tcp.send) ---> Node JS (TCP server) ---> Node JS (Socket.IO server) ---> Browser (running Socket.IO client)</code></p>
<p>Flash understands TCP sockets, so you could probably cut out a step if you use Flash in the browser.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231770</guid>
					<title><![CDATA[Re: Node.JS to OSC via UDP]]></title>
					<link>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231770</link>
					<pubDate>Fri, 21 Sep 2012 21:16:04 +0000</pubDate>
					<dc:creator>rjungemann</dc:creator>

					<description>
						<![CDATA[
						<p>My previous example merely showed how to connect Node JS to Max, meaning it would be good to make command-line utilities that could communicate with Max.</p>
<p>I will try and expand the example with browser functionality when I have some time.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231771</guid>
					<title><![CDATA[Re: Node.JS to OSC via UDP]]></title>
					<link>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231771</link>
					<pubDate>Fri, 21 Sep 2012 22:13:25 +0000</pubDate>
					<dc:creator>rjungemann</dc:creator>

					<description>
						<![CDATA[
						<p>Try the attached example. Simply open Max, then start tcp-io-node-browser.js. Navigate your browser to <a href="http://localhost:5999/index.html" rel="nofollow">http://localhost:5999/index.html</a></p>
<p>From Max, click &#8220;foo bar baz&#8221;. It will send that to the browser. The browser will respond with &#8220;hello from browser&#8221;.</p>
<p>Obviously this is a basic example but shows a round trip from Max to the browser, and back.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231772</guid>
					<title><![CDATA[Re: Node.JS to OSC via UDP]]></title>
					<link>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231772</link>
					<pubDate>Sat, 22 Sep 2012 19:17:42 +0000</pubDate>
					<dc:creator>rjungemann</dc:creator>

					<description>
						<![CDATA[
						<p>Here&#8217;s a library where someone is using Socket.IO to communicate between the browser and Node, then using UDP to communicate between Node and Max.</p>
<p><a href="https://github.com/fde31/MaxClientJS" rel="nofollow">https://github.com/fde31/MaxClientJS</a></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231773</guid>
					<title><![CDATA[Re: Node.JS to OSC via UDP]]></title>
					<link>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231773</link>
					<pubDate>Mon, 24 Sep 2012 05:28:32 +0000</pubDate>
					<dc:creator>Justin</dc:creator>

					<description>
						<![CDATA[
						<p>Again, thank you very much rjungemann. I will try the given examples/project files very soon.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231774</guid>
					<title><![CDATA[Re: Node.JS to OSC via UDP]]></title>
					<link>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231774</link>
					<pubDate>Thu, 21 Mar 2013 09:07:03 +0000</pubDate>
					<dc:creator>timothybone</dc:creator>

					<description>
						<![CDATA[
						<p>How did this turn out @Justin ?</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231775</guid>
					<title><![CDATA[Re: Node.JS to OSC via UDP]]></title>
					<link>http://cycling74.com/forums/topic/node-js-to-osc-via-udp/#post-231775</link>
					<pubDate>Thu, 21 Mar 2013 11:18:07 +0000</pubDate>
					<dc:creator>Siska Ádám</dc:creator>

					<description>
						<![CDATA[
						<p>Hi,</p>
<p>an alternative way could be based on the original post, but replacing <code>[udpreceive]</code> with <code>[sadam.udpReceiver]</code>. In this case, one would simply get the message as a list of ascii byte codes.</p>
<p>Hope that helps,<br />
Ádám</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

