We are about to switch to a new forum software. Until then we have removed the registration on this forum.
is it possible to send/receive information to a different app other than processing using the net library?
I have a really bare bones server running in processing and a really barebones client running in openframeworks and both sides seem to be working but I'm not receiving messages in processing from OF.
Processing code
import processing.net.*;
Server s;
Client c;
String input;
void setup(){
s = new Server(this, 9000);
}
void draw(){
c = s.available();
if(c != null){
input = c.readString();
println(input);
}
}
OpenFrameworks code(.cpp)
void testApp::setup(){
ofSetWindowShape(200, 200);
ofSetVerticalSync(true);
ofBackground(ofColor::red);
udpClient.Create();
udpClient.Connect("192.168.122.35", 9000);
udpClient.SetNonBlocking(true);
cout << "setup server" << endl;
}
//--------------------------------------------------------------
void testApp::update(){
if(ofGetFrameNum() % 60 == 0){
sendData();
}
}
void testApp::sendData(){
string mess = "hello world";
int sent = udpClient.Send(mess.c_str(), mess.length());
printf("=========\n%s\n", ofToString(sent).c_str());
}
with this the Processing up gets up and running just fine with no errors and the OF one gets up and running and prints ========= 11
every second as it should. but i get nothing on the processing end. Any Ideas?
Answers
Ok after some more research it was brought to my attention that the Processing net library uses TCP where as on the OF side I was listening for UDP. A quick OSC sketch from p5 to OF works just fine.