← Back

ofxTcpOsc

github.com/kokinomura/ofxTcpOsc · @kokinomura
OF 0.9 Web/Networking

A lightweight reliable OSC library over TCP for openFrameworks.

16 2 Last commit 10y ago Created 12y ago

Forks

Forks pushed to more recently than kokinomura/ofxTcpOsc itself, plus any admin-confirmed fork with commits of its own — worth checking if you're hitting issues with the original.

naturalinteraction/ofxTcpOsc by @naturalinteraction · ★ 0 · pushed 2y ago
icq4ever/ofxTcpOsc by @icq4ever · ★ 0 · pushed 4y ago

README

ofxTcpOsc



A lightweight reliable OSC library over TCP for openFrameworks.

It's as easy as ofxOsc!

Dependency



Usage



1. Sender



testApp.h
#include "ofxTcpOsc.h"

const string host = "localhost";
const int port = 50000;

class testApp : public ofBaseApp{
	// definitions
	ofxTcpOscSender sender;
}


testApp.cpp
void testApp::setup() {
    sender.setup(host, port);
}

void testApp::sendMessage {
    ofxTcpOscMessage m;
    m.setAddress("/testAddress");
    m.addStringArg("test message");
    m.addIntArg(0);
    m.addInt64Arg(123);
    m.addFloatArg(0.123);
    
    sender.sendMessage(m);
}


2. Receiver



testApp.h
#include "ofxTcpOsc.h"

const int port = 50000;

class testApp : public ofBaseApp{
    // definitions
    ofxTcpOscReceiver receiver;
}


testApp.cpp
void testApp::setup() {
    receiver.setup(port);
}

void testApp::update() {
    while (receiver.hasWaitingMessages()) {
        ofxTcpOscMessage m;
        receiver.getNextMessage(&m);
        
        if (m.getAddress() == "/testAddress") {
            string message = m.getArgAsString(0);
            int i = m.getArgAsInt32(1);
            uint64_t j = m.getArgAsInt64(2);
            float f = m.getArgAsFloat(3);
        }
    }
}


Support

Get this addon

HTTPS
SSH