[PD] netreceive vs mrpeach/udpreceive in batch mode

Charles Z Henry czhenry at gmail.com
Mon Jan 27 02:20:32 CET 2020


Hi list,

I have been writing a patch to send messages to/from a subprocess in
batch mode.  First, I wrote the patch with mrpeach's
udpsend/udpreceive and got it working.  It's just a simple handshake:

the toplevel process starts listening on port 16000 for a message [1
1(.  When it receives that message, it sends back a message [1
subprocess#( to localhost port 15999.

The subprocess starts up, listens on port 15999 and sends a message [1
1( to localhost port 16000.  When it gets a message [1 n( on port
15999, it outputs n as the subprocess #, and opens a new port 16000+n
(and closes 15999).

This was fine, except udpsend/receive pairs exchange binary numbers
(0-255).  It will work, but it doesn't make the patches as easily
readable.  It will still be possible to pass integers larger than 255
with a little patching, but some flexibility would be nice.

I thought "netsend -u"/"netreceive -u" would make a good replacement
with text instead.

It runs fine during the first part of testing with the GUI.  I test
"-nogui".  Also fine.  Then, "-batch" added.  Here the cpu load goes
to 100% (which didn't happen with mrpeach udpsend/receive).  I'm able
to strace and see the first message [1 1( sent.  Then, the process
keeps on going but doesn't receive any further UDP messages.

I'm able to find a sourceforge ticket from 2012:
https://sourceforge.net/p/pure-data/bugs/943/
and basically, I'm looking for the same usage case which is batch mode
processing under supervision from another Pd process.

I'm guessing that mrpeach/udpreceive and netreceive have different
polling behavior that can explain this, but I don't see it yet.  Is
there anyone reading, who's dealt with this issue before?

Chuck





More information about the Pd-list mailing list