I'm trying to create a simple PD patch on my computer that will connect via OSC to Bela, and Bela will send PD the Bela analog block size, number of channels, and sample rate. I'm using the example "Osc" c++ code from the Bela IDE. However, I get this error:

Running project ...
Waiting for handshake ....
OscReceiver: oscpkt error parsing received message: 1
timeout! : did you start the node server? `node /root/Bela/resources/osc/osc.js
Error: unable to initialise audio
Makefile:606: recipe for target 'runide' failed
make: *** [runide] Error 1
Bela stopped

this is the Bela OSC code:



#include <Bela.h>
#include <libraries/OscSender/OscSender.h>
#include <libraries/OscReceiver/OscReceiver.h>

OscReceiver oscReceiver;
OscSender oscSender;
int localPort = 7562;
int remotePort = 5000;
const char* remoteIp = "192.168.7.1";

// parse messages received by the OSC receiver
// msg is Message class of oscpkt: http://gruntthepeon.free.fr/oscpkt/
bool handshakeReceived;
void on_receive(oscpkt::Message* msg, void* arg)
{
	if(msg->match("/osc-setup-reply"))
		handshakeReceived = true;
	else if(msg->match("/osc-test")){
		int intArg;
		float floatArg;
		msg->match("/osc-test").popInt32(intArg).popFloat(floatArg).isOkNoMoreArgs();
		printf("received a message with int %i and float %f\n", intArg, floatArg);
		oscSender.newMessage("/osc-acknowledge").add(intArg).add(4.2f).add(std::string("OSC message received")).send();
	}
}

bool setup(BelaContext *context, void *userData)
{
	oscReceiver.setup(localPort, on_receive);
	oscSender.setup(remotePort, remoteIp);

	// the following code sends an OSC message to address /osc-setup
	// then waits 1 second for a reply on /osc-setup-reply
	oscSender.newMessage("/osc-setup").send();
	int count = 0;
	int timeoutCount = 10;
	printf("Waiting for handshake ....\n");
	while(!handshakeReceived && ++count != timeoutCount)
	{
		usleep(100000);
	}
	if (handshakeReceived) {
		printf("handshake received!\n");
	} else {
		printf("timeout! : did you start the node server? `node /root/Bela/resources/osc/osc.js\n");
		return false;
	}
	return true;
}

void render(BelaContext *context, void *userData)
{

}

void cleanup(BelaContext *context, void *userData)
{

}

and this is my PD patch:

any ideas? thanks!

Here you are trying to use [oscformat] to send a message containing the string /osc-setup-reply to an empty address. Instead, you need to send an empty message to the address /osc-setup-reply. Perhaps confusingly, the syntax to do that is:

[b]
|
[oscformat osc-setup-reply]

(see the oscformat help file for more details).