<p dir="ltr">Hi Jose,</p>
<p dir="ltr">Yes, that's a solution, you're right. But I was trying to do everything in ChucK, also to avoid further bottlenecks due to conversions from UDP to TCP. But I'll consider this option in case I can't find better solutions.</p>
<p dir="ltr">Cheers,<br>
Mario</p>
<p dir="ltr">Sent from my Wiko ROBBY</p>
<div class="quote">On Dec 3, 2018 17:33, José de Abreu &lt;abreubacelar@gmail.com&gt; wrote:<br type='attribution'><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Just an idea, i know that you patch in puredata too Mario. How about making chuck send udp to puredata and making puredata send tcp from there? actually puredata could be any other software, just to make the bridge</div><br /><div class="elided-text"><div dir="ltr">Em Seg, 3 de dez de 2018 13:24, Mario Buoninfante &lt;<a href="mailto:mario.buoninfante&#64;gmail.com">mario.buoninfante&#64;gmail.com</a> escreveu:<br /></div><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Jordan,</div><div><br /></div><div>Thanks for your reply. <br /></div><div>I got your points and I think you&#39;re right about the different design goals. In my case I simply need to talk with a piece of HW that &#39;speaks&#39; TCP. But the &#39;netcat&#39; solution doesn&#39;t seem to be the best one, for all the reasons you mentioned. Probably it&#39;s still the right direction, but it needs to be refined for sure. <br /></div><div>If I simple open a port using Std.system(), without immediately closing it, that&#39;ll take over the shell and my ChucK script won&#39;t proceed (the shell waits for some input). <br /></div><div>The idea of having 2 shells opened, and make 2 different scripts talking to each other, could be a solution and I want to give it a try. That said, having to convert from OSC/UDP, to TCP could further affect the performances. Anyway, I&#39;ll have a look and share with the mailing list in case I end up with something useful.</div><div><br /></div><div>Cheers,</div><div>Mario<br /></div></div><br /><div class="elided-text"><div dir="ltr">On Sun, 2 Dec 2018 at 20:47, Jordan Orelli &lt;<a href="mailto:jordanorelli&#64;gmail.com">jordanorelli&#64;gmail.com</a>&gt; wrote:<br /></div><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I&#39;m like ... 80% sure that there&#39;s no TCP-handling facilities built in, but I may be wrong here. If there is, I surely don&#39;t know about it.</div><div dir="ltr"><br /></div><div dir="ltr">Can you tell us a little more about your use case?</div><div dir="ltr"><br /></div><div dir="ltr">The design goals of TCP and ChucK are very different with respect to <i>time</i>. ChucK is designed around guarantees about time and timeliness. TCP is not designed around timeliness or latency in general: TCP is designed around guarantees about ordering (messages always appear in order) and delivery (messages are guaranteed to be delivered). Since every byte sent over a TCP socket has to be eventually acknowledged, and all bytes have to be processed in order, a stall in the network (a normal occurrence) could mean later messages being delayed, much like a traffic jam. It&#39;s not possible to have timing <i>guarantees </i>with TCP.<br /><div><br /></div><div>I&#39;m not sure how to find it in the source code, but maybe someone else here knows: does calling Std.system create a new shell process for each invocation? That would be a fairly inefficient way to go about things. Also since you&#39;re piping to another process, that&#39;s a new netcat process for each invocation (so it&#39;s either one or two processes per invocation), and a new TCP socket for every invocation. TCP is <i>especially slow </i>at <i>the very beginning of communication.</i></div><div><br /></div><div>If I were in your shoes, I would probably write a separate program that acts as a server and serves an OSC-based protocol. This server would take your messages as OSC and translate them and then forward them to the intended recipient over just one TCP connection and continue to use that one connection the whole time. It may or may not respond to your ChucK program over OSC, depending on whether you want the ChucK program to get responses to its requests (probably not?).</div><div><br /></div></div></div><br /><div class="elided-text"><div dir="ltr">On Sat, Dec 1, 2018 at 1:25 PM mario buoninfante &lt;<a href="mailto:mario.buoninfante&#64;gmail.com">mario.buoninfante&#64;gmail.com</a>&gt; wrote:<br /></div><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div>
    <p>Hi,</p>
    <p><br />
    </p>
    <p>It seems like accessing the shell and use &#34;netcat&#34; (on Unix) is a
      possible solution. Quite an <i>exotic</i> workaround but better
      than nothing I&#39;d say.</p>
    <p>Something like that seems to work:</p>
    <p><i>// run ChucK with &#34;--caution-to-the-wind&#34;</i><i><br />
      </i><i><br />
      </i><i>&#34;echo -ne &#39;&#34; &#61;&gt; string prefix;</i><i><br />
      </i><i>&#34;&#39; | netcat <a href="http://127.0.0.1">127.0.0.1</a> 3333 &#34; &#61;&gt; string suffix;  //
        netcat &lt;target ip&gt; &lt;target port&gt;</i><i><br />
      </i><i><br />
      </i><i>while(true)</i><i><br />
      </i><i>{</i><i><br />
      </i><i>  Math.random2(0,127) &#61;&gt; int r;</i><i><br />
      </i><i>  prefix &#43; Std.itoa(r) &#43; suffix &#61;&gt; string msg;</i><i><br />
      </i><i>  Std.system(msg);</i><i><br />
      </i><i><br />
      </i><i>  second &#61;&gt; now;</i><i><br />
      </i><i>}</i></p>
    <p><i></i><br />
    </p>
    <p>Please, let me know if anyone has a better solution.<br />
    </p>
    <p><br />
    </p>
    <p>Cheers,</p>
    <p>Mario<br />
    </p>
    <div>On 01/12/2018 18:04, mario buoninfante
      wrote:<br />
    </div>
    <blockquote>Hi,
      <br />
      <br />
      <br />
      I also tried opening a file in /dev/tcp/&lt;target
      ip&gt;/&lt;target port&gt;, but it didn&#39;t work. I&#39;m on Ubuntu
      16.04. Any idea?
      <br />
      <br />
      <br />
      Cheers,
      <br />
      <br />
      Mario
      <br />
      <br />
      <br />
      On 30/11/2018 16:52, Mario Buoninfante wrote:
      <br />
      <blockquote>Hi,
        <br />
        <br />
        Does anyone know if it&#39;s possible to use TCP instead of UDP in
        ChucK?
        <br />
        <br />
        Cheers,
        <br />
        Mario
        <br />
      </blockquote>
      <br />
    </blockquote>
    <pre>-- 
Electronic Musician, Creative Coder, QA Engineer
<a href="https://vimeo.com/creativecodingsalerno"></a><a href="https://vimeo.com/creativecodingsalerno">https://vimeo.com/creativecodingsalerno</a>
<a href="http://mbuoninfante.tumblr.com/"></a><a href="http://mbuoninfante.tumblr.com">http://mbuoninfante.tumblr.com</a>/
<a href="https://github.com/mariobuoninfante"></a><a href="https://github.com/mariobuoninfante">https://github.com/mariobuoninfante</a>
<a href="https://bitbucket.org/mariobuoninfante/"></a><a href="https://bitbucket.org/mariobuoninfante">https://bitbucket.org/mariobuoninfante</a>/</pre>
  </div>

_______________________________________________<br />
chuck-users mailing list<br />
<a href="mailto:chuck-users&#64;lists.cs.princeton.edu">chuck-users&#64;lists.cs.princeton.edu</a><br />
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br />
</blockquote></div>
_______________________________________________<br />
chuck-users mailing list<br />
<a href="mailto:chuck-users&#64;lists.cs.princeton.edu">chuck-users&#64;lists.cs.princeton.edu</a><br />
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br />
</blockquote></div>
_______________________________________________<br />
chuck-users mailing list<br />
<a href="mailto:chuck-users&#64;lists.cs.princeton.edu">chuck-users&#64;lists.cs.princeton.edu</a><br />
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br />
</blockquote></div>
</blockquote></div>