Send files (and triggers) to RPi from OS X under a wifi network

I am thinking a good way to send a xml file under a wireless network between the RPi and a OSX laptop or even an iOS device.

I am looking in the ofxAddons section on the ARM section here in the forum, and I have seen some alternatives. But I am not sure if some of this are old, not proper for RPi or if there are other better ones or easy options; like maybe some of the OF core classes…

I want to know your advice or opinion about:

Also, I am looking for something to send realtime commands, mainly like some (not too much) buttons or triggers.
I have seen these options:

ofxHTTP has examples for posting files (which could include XML files -

You can post using the ofxHTTP client (change this to a PostRequest and attach your file and add your file using this method:

Anyway … it’s pretty straightforward :smile:

If you want to do realtime commands back and forth, I’d recommend taking a look at which can use websockets or post requests.

I’m happy to answer questions if you go down that route …

1 Like

Thanks a lot Bakercp!
I just tryed to run the ‘master/example_basic_post_server’ example you toldme, but I get this error:

clang: warning: -lpthread: ‘linker’ input unused
/Users/manu/Documents/of_v0.8.4_osx_release/apps/myApps/example_basic_post_server/src/ofApp.cpp:76:16: error: no member named ‘Utils’ in namespace ‘ofx::HTTP’
ofx::HTTP::Utils::dumpNameValueCollection(args.getForm(), ofGetLogLevel());

some of the others compile fine, I am just starting to look inside them…

EDIT: I made a search for ‘dumpNameValueCollection’… What about doing this?:

//    ofx::HTTP::Utils::dumpNameValueCollection(args.getForm(), ofGetLogLevel());
    ofx::HTTP::HTTPUtils::dumpNameValueCollection(args.getForm(), ofGetLogLevel());

I just done my first testing. I tryed with the 2 examples you toldme on the same computer.
I started the ‘example basic post server’ by-passing the line (To make a fast check, maybe was required :wink: … but) I mentioned above:

void ofApp::onHTTPFormEvent(ofx::HTTP::PostFormEventArgs& args)
    ofLogNotice("ofApp::onHTTPFormEvent") << "";
//    ofx::HTTP::Utils::dumpNameValueCollection(args.getForm(), ofGetLogLevel());

then on the ‘example basic file client’ I made:

//    ofx::HTTP::GetRequest request(url);
    ofx::HTTP::PostRequest request(url);
    std::string postFilename = "file1.xml";
    std::string postFilepath = "filesToSend/";
    request.addFormFile(postFilename, postFilepath, ofx::HTTP::BaseRequest::DEFAULT_MEDIA_TYPE);

After running first the server and then the client, I didn’t see the file uploaded to ‘data/uploads’… where i supposed would be the file. Also on the client console, didn’t appears any message. … I am not sure the filename is reading correct, because when I change the name no error message appears. I get an error in console if the path do not exists.
EDIT: Maybe the path must be the path+filename?

How many things I am doing bad? :blush:

For the xml file transfer, can’t you just run a samba server and write files like that? I’m doing it constantly when compiling on OSX and testing on the rpi. (so samba runs on the pi)
I don’t see why it shouldn’t work in the opposite direction. (but I haven’t tried it yet)

I didn’t tried again with this ofxHTTP addon, because I was stucked making it to work.
Also I am not sure if I need it, because I don’t need to send too much files.

Now I am using ofxOsc for sending the trigs, and also some little files, like the xml I need.
Something like this:


    ofxOscMessage m;


 ofBuffer buffer = m.getArgAsBlob(0);

I hope there’s some “error check” or something… :wink: but I don’t know.
It’s working nice.

I am using AFP (like Samba) to send with the finder the /src files to RPi to compile; but I guess you mean it’s possible to use some command inside OF…