std::cin

Hej everybody

I am trying to do a OF <–> Adobe AIR communication.

There are several ways of doing this, like TCP (slow, didn’t bother) UDP (fast, got that working ok, vice versa) and… direct cout / cin.

Here is an example on the adobe site of a basic communication between AIR and a C++ program.

In the example is some simple code of a program waiting for some input, if it receives input it shuts down. To easy.

What I, ofcourse, want to create is fast runtime communication without being held to wait for input data.

I figured out a way to send data from OF to AIR directly using

  
std::cout <<"data" << std::endl;  

(pretty straight forward)

But i find it quite troublesome to do inline or maybe eventually event based input (AIR -> OF) data transfer (without the while loops to wait for input)

Is there anyone who can tell me to do something like:

  
if (cin data is present)  
  readdata  
else  
  dont bother  

thanks!

Jarno

Hi Jarno,

Checkout ofxOSC, which is perfect for what you need. We use it all the time for flash <–[other software] communication. There is a flash-osc library somewhere (even UDP). There is also ofxTUIO which is something on top of OSC a quick google gave me:

Gr.
roxlu

Hoi! (hej)

Thanks for your answer roxlu,

Since Adobe Air 2.0 there is supposed to be a way to directly communicate with native processes (like an OF app) through the cin and cout of the process. Check out the example link in my first post.

I am aware of the possibilties of osc, tcp, udp etc (and got that working as well), but what I really would like to do is find a way to avoid these protocols (tcp proxy, udp localhost / port binding and stuff) and do this direct cin/cout communication.

It might not be really stable of reliable, I have to find that out, but it will be extremely fast since it is like a direct pipeline…

Cheers!

extra stuff
there is a ofxNetwork addon for OF (standard) wich has a ofxUDPManager class, wich can, indeed, be used to directly communicate with AIR2.0 through UDP.
Let me know if you want some AS3 + OF sources for that, I should be able to create a little demo of it at home (@ work now)

offtopic
btw roxlu, sorry I haven’t been to any of the OF meetings yet, I still would like to join sometime, but have been quite busy … (and got no laptop…))

anyone?

hi Jarno

did you ever found a solution ?

i also use tcp directly to flash but it has a delay of 1 second or more it would be great to have a direct data transfer.

@paranoio This works well for under a second
https://github.com/roxlu/ofxFlashCommunication

wow amf !
thanks.