<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[TCP&#x2F;IP communication from the unix server to the Pure Data]]></title><description><![CDATA[<p>Hi everyone,</p>
<p>I am interested in TCP/IP communication from the Unix server to the Pure Data. I have it realized using sockets on the Unix server side, and netclient on the Pure Data side. I exploited the chat-server tutorial for this.</p>
<p>Now the problem lies that the server is streaming the data out as a &quot;string&quot; message delimited with &quot;;&quot;</p>
<p><strong>My question is, is there a way to send something other than string message to Pure Data, like byte-stream or serialized number stream? Can Pure Data receive such messages?</strong></p>
<p>Since string takes too many bytes to transfer, for example number &quot;1024;&quot; is already 5 bytes, while any integer number is just 4 bytes.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 17:18:40 GMT</lastBuildDate><atom:link href="http://forum.pdpatchrepo.info/topic/7153.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 27 Feb 2013 12:59:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to TCP&#x2F;IP communication from the unix server to the Pure Data on Wed, 27 Feb 2013 12:59:51 GMT]]></title><description><![CDATA[<p>Hi everyone,</p>
<p>I am interested in TCP/IP communication from the Unix server to the Pure Data. I have it realized using sockets on the Unix server side, and netclient on the Pure Data side. I exploited the chat-server tutorial for this.</p>
<p>Now the problem lies that the server is streaming the data out as a &quot;string&quot; message delimited with &quot;;&quot;</p>
<p><strong>My question is, is there a way to send something other than string message to Pure Data, like byte-stream or serialized number stream? Can Pure Data receive such messages?</strong></p>
<p>Since string takes too many bytes to transfer, for example number &quot;1024;&quot; is already 5 bytes, while any integer number is just 4 bytes.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data</guid><dc:creator><![CDATA[happilylazy]]></dc:creator><pubDate>Wed, 27 Feb 2013 12:59:51 GMT</pubDate></item><item><title><![CDATA[Reply to TCP&#x2F;IP communication from the unix server to the Pure Data on Sat, 02 Mar 2013 20:30:18 GMT]]></title><description><![CDATA[<p>/b/umping for greater good</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/2</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/2</guid><dc:creator><![CDATA[happilylazy]]></dc:creator><pubDate>Sat, 02 Mar 2013 20:30:18 GMT</pubDate></item><item><title><![CDATA[Reply to TCP&#x2F;IP communication from the unix server to the Pure Data on Fri, 08 Mar 2013 17:24:10 GMT]]></title><description><![CDATA[<p>UPDATE: For everyone that stumbles upon this post in search for the answer.</p>
<p>Apparently [netclient] on the Pure Data side cannot receive nothing else than ; delimited messages.<br />
So the solution for the problem posed above:<br />
<strong>My question is, is there a way to send something other than string message to Pure Data, like byte-stream or serialized number stream? Can Pure Data receive such messages?</strong></p>
<p>The solution is to use [tcpclient], it can receive byte-stream data.</p>
<p>Now I have another problem regarding the data read, on how to convert it back to usable numbers.</p>
<p>From my UNIX server I am sending a structure</p>
<p>typedef struct {<br />
int var_code;<br />
int sample_time;<br />
int hr;<br />
float hs;<br />
} phy_data;</p>
<p>Sample data might be 2 1000000 51 2000.56</p>
<p>When recieved and printed in Pure Data I get output like this:</p>
<p>&gt;&gt;&gt;: 2 0 0 0 104 34 9 0 51 0 0 0 235 50 48 69</p>
<p>You can notice number 2 and number 51 clearly, I guess the others are correct as well. Might be some network inversion of LSB/MSB.</p>
<p><strong>How can I get these numbers back to a usable format?</strong></p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/3</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/3</guid><dc:creator><![CDATA[happilylazy]]></dc:creator><pubDate>Fri, 08 Mar 2013 17:24:10 GMT</pubDate></item><item><title><![CDATA[Reply to TCP&#x2F;IP communication from the unix server to the Pure Data on Fri, 08 Mar 2013 22:13:26 GMT]]></title><description><![CDATA[<p>Sending to the list might help as Martin Peach is signed up there, so you might address your question straight to him..</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/4</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/4</guid><dc:creator><![CDATA[alexandros]]></dc:creator><pubDate>Fri, 08 Mar 2013 22:13:26 GMT</pubDate></item><item><title><![CDATA[Reply to TCP&#x2F;IP communication from the unix server to the Pure Data on Sat, 09 Mar 2013 15:49:56 GMT]]></title><description><![CDATA[<p>Thank you for the suggestion, I did as you proposed.<br />
I will post the answer here once resolved.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/5</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/5</guid><dc:creator><![CDATA[happilylazy]]></dc:creator><pubDate>Sat, 09 Mar 2013 15:49:56 GMT</pubDate></item><item><title><![CDATA[Reply to TCP&#x2F;IP communication from the unix server to the Pure Data on Sat, 09 Mar 2013 20:13:45 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>i had the same problem connecting Blender to PD. I'm using the [udpreceive] object.</p>
<p>In PD extended theres an object [moocow/bytes2any]. It converts from bytes(bytestring) to a PD list. After that you can use the [route] object as usual.</p>
<p>greets, kq</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/6</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/6</guid><dc:creator><![CDATA[kompaqt.core]]></dc:creator><pubDate>Sat, 09 Mar 2013 20:13:45 GMT</pubDate></item><item><title><![CDATA[Reply to TCP&#x2F;IP communication from the unix server to the Pure Data on Sun, 10 Mar 2013 17:44:04 GMT]]></title><description><![CDATA[<p>Can you explain how did you do the conversion using [moocow/bytes2any] and [route], or post a sample patch.<br />
I am stuck heavily on this.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/7</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/7</guid><dc:creator><![CDATA[happilylazy]]></dc:creator><pubDate>Sun, 10 Mar 2013 17:44:04 GMT</pubDate></item><item><title><![CDATA[Reply to TCP&#x2F;IP communication from the unix server to the Pure Data on Mon, 11 Mar 2013 20:49:45 GMT]]></title><description><![CDATA[<p>Hey,</p>
<p>i hope this helps. My message from Blender consists of a bytestring (address, stuff you want to send, 0). The 0 is used to delimit the message which is spit out by the bytes2any object. After that you can route the list by the address you gave it. See the attachment.</p>
<p>kq</p>
<p><a href="http://www.pdpatchrepo.info/hurleur/UdpTest.pd" rel="nofollow">http://www.pdpatchrepo.info/hurleur/UdpTest.pd</a></p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/8</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/8</guid><dc:creator><![CDATA[kompaqt.core]]></dc:creator><pubDate>Mon, 11 Mar 2013 20:49:45 GMT</pubDate></item><item><title><![CDATA[Reply to TCP&#x2F;IP communication from the unix server to the Pure Data on Mon, 11 Mar 2013 20:50:28 GMT]]></title><description><![CDATA[<p>Apparently, I was right about the inverted data in network communications.<br />
Is there a method for correct endianness in Pure Data, like these C functions:</p>
<p>ntohs()--&quot;Network to Host Short&quot;<br />
ntohl()--&quot;Network to Host Long&quot;</p>
<p>UPDATE:<br />
Thanks for the code kompaqt.core, I'll test it immediately.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/9</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/9</guid><dc:creator><![CDATA[happilylazy]]></dc:creator><pubDate>Mon, 11 Mar 2013 20:50:28 GMT</pubDate></item><item><title><![CDATA[Reply to TCP&#x2F;IP communication from the unix server to the Pure Data on Mon, 11 Mar 2013 21:05:49 GMT]]></title><description><![CDATA[<p>Hey happilylazy,</p>
<p>i never heard of those functions, and obviously got lucky to get it working without any proper networking knowledge. If it helps, my python code uses (socket.AF_INET,socket.SOCK_DGRAM) which should be the standard udp socket. I read about AF_INET in the ntohl() function descripition. So if my python message is reversed then the bytes2any object is able to get it in the right order.</p>
<p>kq</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/10</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/10</guid><dc:creator><![CDATA[kompaqt.core]]></dc:creator><pubDate>Mon, 11 Mar 2013 21:05:49 GMT</pubDate></item><item><title><![CDATA[Reply to TCP&#x2F;IP communication from the unix server to the Pure Data on Wed, 13 Mar 2013 09:17:41 GMT]]></title><description><![CDATA[<p>Thank you for your input and your code [kompaqt.core], looking at (socket.AF_INET,socket.SOCK_DGRAM) I realized that I was using the wrong endian method on my UNIX server, it has to be ntohl().<br />
Now I got it correct, and I am receiving data (bytes) in the correct order.</p>
<p><strong>&gt;&gt;&gt;: 0 0 0 2 0 10 114 26 0 0 0 51 0 16 242 78</strong></p>
<p>Sample data might be 2 1000000 51 2000.56, which could be read in the data ... somewhat <img class="emoji emoji-extended" src="http://forum.pdpatchrepo.info/plugins/nodebb-plugin-emoji-extended/images/grinning.png" title=":)" alt=":)" /></p>
<p>xxx---------------------------------xxx<br />
which is exactly the opposite of the wrong initial condition<br />
&gt;&gt;&gt;: 2 0 0 0 104 34 9 0 51 0 0 0 235 50 48 69<br />
xxx-----------------------------------------------xxx</p>
<p><strong>Now my question is, how do I get four compact numbers to work with?</strong><br />
Now I have a series of bytes, at least in the correct order.</p>
<p>I haven't been able to extract the data using [bytes2any] and [route], so I prepared a small patch to demonstrate the problem, maybe you can show me by modifying it?</p>
<p><a href="http://www.pdpatchrepo.info/hurleur/server_comm.pd" rel="nofollow">http://www.pdpatchrepo.info/hurleur/server_comm.pd</a></p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/11</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/11</guid><dc:creator><![CDATA[happilylazy]]></dc:creator><pubDate>Wed, 13 Mar 2013 09:17:41 GMT</pubDate></item><item><title><![CDATA[Reply to TCP&#x2F;IP communication from the unix server to the Pure Data on Wed, 13 Mar 2013 16:15:03 GMT]]></title><description><![CDATA[<p>Hi again,</p>
<p>i tried your patch but didn't get out the real values. It seems the [bytes2any] produces some weird ascii stuff.</p>
<p>You might want to check out the pdstring-help.pd in pd/extra/moocow and <a href="http://puredata.hurleur.com/sujet-2533-ascii-float" rel="nofollow">http://puredata.hurleur.com/sujet-2533-ascii-float</a> .</p>
<p>Maybe you just need to delimit every value you are sending with &quot; &quot; (space?) or a 0 byte. My message in Blender looks like: &lt;bytesfrom int/float/string&gt;+&quot; &quot;+&lt;anotherbyte&gt;+&quot; &quot;+etc.</p>
<p>Otherwise i have no idea what could be wrong. But it seems your close to the real deal.</p>
<p>Hope you can figure it out, kq</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/12</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/12</guid><dc:creator><![CDATA[kompaqt.core]]></dc:creator><pubDate>Wed, 13 Mar 2013 16:15:03 GMT</pubDate></item><item><title><![CDATA[Reply to TCP&#x2F;IP communication from the unix server to the Pure Data on Thu, 14 Mar 2013 17:39:24 GMT]]></title><description><![CDATA[<p>[solved]<br />
BUT BEFORE FOLLOWING THIS, NOTE THAT FLOATING POINT NUMBER IS SOMETHING THAT YOU DON'T WANT TO PARSE, IF YOU LIKE YOUR NERVES.</p>
<p>The first problem is<br />
1. Error was in using on the server side an ntohl() on a float number, which corrupts it heavily. Mark my words, ntohl() is an enemy of the float.<br />
Just receive it reversed and manually work out the conversion, you HAVE to do it manually anyways <img class="emoji emoji-extended" src="http://forum.pdpatchrepo.info/plugins/nodebb-plugin-emoji-extended/images/stuck_out_tongue_winking_eye.png" title=":P" alt=":P" /></p>
<p>2. Float is a complex standard, even more complex when Pure Data converts everything to decimal partially per byte. Separate Mantissa, Exponent and Sign using bitwise operators [&lt;&lt;][&gt;&gt;], and work out the float conversion.<br />
Follow this thread for Mantissa, that one is the hardest <a href="http://stackoverflow.com/questions/15393113/convert-floating-point-number-from-binary-to-a-decimal-number/" rel="nofollow">Convert floating point number from binary to a decimal number</a></p>
<p>Good luck ^^</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/13</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/7153/tcp-ip-communication-from-the-unix-server-to-the-pure-data/13</guid><dc:creator><![CDATA[happilylazy]]></dc:creator><pubDate>Thu, 14 Mar 2013 17:39:24 GMT</pubDate></item></channel></rss>