I need to be able to communicate between two applications that reside on the same machine. One is using Flex and the other is in C++. I would like to be able to call functions and pass arguments to each other. What is the best way to communicate between them? I was thinking about using sockets.
As for now yes, you'll need to use sockets.
AIR 2.0 will provide access to native processes, but that will require a native (per OS) installer. More info: http://www.mikechambers.com/blog/2009/09/22/fotb-slides-advanced-desktop-development-with-adobe-air/
As for AIR 1.x, Mike Chambers posted a sample library called CommandProxy which does the trick. It provides code for AS3 and .NET which could easily be ported to C++ if you have a decent XML parser.
The basic idea is that each compnent can send each other XML "packets" across the wire where each one has an ID to ensure the request/response can be tied together. However, both the AS3 and .NET code don't account for slow or fast TCP/IP speeds where two XML chunks could be sent on one packet or one XML chunk split across two. Any ways, it does the trick.
Also, you could look for a C++ AMF (ActionScript Message Format) library so that you could serialize AS3 objects over the wire which would have a more "integrated" feel.