<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>TL;DR: [iemnet/tcpserver] + [mrpeach/slipenc] + [mrpeach/slipdec]
      :-)</p>
    <p>Depending on your payload, you might also get away with FUDI
      (ASCII text delimited by semicolons), which is used internally by
      Pd and slightly easier to parse (but more limited).<br>
    </p>
    <p>I've said this elsewhere: as much as I like (and use) the mrpeach
      library, I avoid the net objects (especially [tcpclient] and
      [tcpserver]) because there are too many problems in the code.
      [iemnet], on the other hand, has been (re)written and maintained
      by actual domain experts.<br>
    </p>
    <p>Christof<br>
    </p>
    <div class="moz-cite-prefix">On 15.06.2020 17:29, Roman Haefeli
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:94230e5ec75e7737db7e17af9c358ca456c1095e.camel@gmail.com">
      <pre class="moz-quote-pre" wrap="">Hi Rold,
Hi Martin

On Mon, 2020-06-15 at 09:44 -0400, Martin Peach wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Based on my assumptions, it may be that the OS is delaying sending
the
messages in case you're not finished sending them. You need a break
of
some minimum time before the whole lot gets sent.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
That probably forces the underlying framework to create messages of the
desired format. What if you want to send many messages immediately?

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap=""> The OS may delay
longer in the case of a wireless connection to avoid network
congestion. This is because TCP has no concept of packet or
'datagram'
like UDP -- you can keep sending until you close the connection, so
one way is to close the connection after each message. Another way
would be to use a longer metro tick period so the stack times out and
sends.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
How can you know what is a time that works (over wifi, vpn, ethernet)?
That is not using the TCP protocol as intended.

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap=""> Also try sending a longer message to force it to be sent.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
What a horrible advice! Just stuff more unnecessary data into to pipe
to force it to put delimiters at the right spot!

Seriously, what you lack is some kind of delimiting mechanism in order
to be able to transmit packets through a stream-oriented protocol such
as TCP or serial line. mrpeach tcp classes do a great job in
obfuscating the true nature of TCP by outputting randomly assembled
lists of floats instead of a stream of float (like iemnet). 

OTOH, mrpeach comes with [slipenc] and [slipdec] which implement SLIP
which is probably the simplest available delimiting mechanism.


This should work:

[send <your message encoded as list of bytes>(
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
[slipenc]
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
[tcpclient]

[tcpserver]
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
[slipdec]
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
[print]


I'm sure there is some implementation of SLIP for the NodeMCU
somewhere.

Things would get more complicated when you receive TCP data from many
clients in parallel, but you seem to want to only send to many clients.

An alternative approach would be to use UDP instead of TCP. UDP thinks
already in packets, but chances are that packets are lost on the way,
while TCP is absolutely reliable.

Roman


</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
<a class="moz-txt-link-abbreviated" href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list
UNSUBSCRIBE and account-management -> <a class="moz-txt-link-freetext" href="https://lists.puredata.info/listinfo/pd-list">https://lists.puredata.info/listinfo/pd-list</a>
</pre>
    </blockquote>
  </body>
</html>