# Communication between apps

**URL:** <https://discourse.processing.org/t/communication-between-apps/18795>\
**Category:** Libraries\
**Created:** [March 19, 2020, 2:05pm UTC](https://discourse.processing.org/t/communication-between-apps/18795 "2020-03-19T14:05:25Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![julianop](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@julianop](https://discourse.processing.org/u/julianop)\
**Post date:** [March 19, 2020, 2:05pm UTC](https://discourse.processing.org/t/communication-between-apps/18795/1 "2020-03-19T14:05:25Z")

</div>

Is there a way of passing data between apps in Processing, such as OLE ?

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [March 19, 2020, 2:29pm UTC](https://discourse.processing.org/t/communication-between-apps/18795/2 "2020-03-19T14:29:09Z")

</div>

You could use the OscP5 lib. However, it only works in one direction. If you run the code below in two sketches on the same PC, with the remoteLocation being the IP of the PC, the second sketch that will be started takes the lead and sends messages to the first one.

```auto
import oscP5.*;
import netP5.*;

OscP5 oscP5;
NetAddress remoteLocation;
int x, y;

void setup() {
  size(400, 400);
  oscP5 = new OscP5(this, 12000); 
  remoteLocation = new NetAddress("192.168.25.5", 12000); // 192.168.25.4 has to be the IP of the other phone/PC
  fill(0);
}

void draw() {
  background(255);  
  ellipse(x, y, 10, 10);
}

void oscEvent(OscMessage m) {
  // if(m.checkAddrPattern("/tes") == true) {
  // if(m.checkTypetag("ii")) { 
  x = m.get(0).intValue(); 
  y = m.get(1).intValue();
  // }  
  //}
}

void mouseDragged() {
  oscP5.send("/tes", new Object[] {new Integer(str(mouseX)), new Integer(str(mouseY))}, remoteLocation);
}

/*
 Address patterns in the OSC protocol are used as "labels" to switch/direct easily to different functions
 using "checkAddrPattern(/yourLabel)"
 The typetag is actually a string containing the order and amount of data types that you use in 
 the Object[] parameters. For instance; "ifs" means three parameters in object respectively, int, float, and string 
 */

```

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [March 19, 2020, 3:23pm UTC](https://discourse.processing.org/t/communication-between-apps/18795/3 "2020-03-19T15:23:11Z")

</div>

> [@julianop](#):
>
> Is there a way of passing data between apps in Processing

Its not [OLE](https://en.wikipedia.org/wiki/Object_Linking_and_Embedding) but I have used this to talk between apps across the planet.

> **[Network](https://processing.org/tutorials/network/)**
>
> An introduction to sending and receiving data with clients and servers.

> **[Network / Libraries](https://processing.org/reference/libraries/net/index.html)**
>
> Send and receive data over the Internet through simple clients and servers.

Examples in Processing IDE:  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/894dc0c48f8abba79f34fef2621fd7ede9123814.png)

`:)`

---

<div class="post-metadata">

**Author:** ![julianop](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@julianop](https://discourse.processing.org/u/julianop)\
**Post date:** [March 19, 2020, 5:52pm UTC](https://discourse.processing.org/t/communication-between-apps/18795/4 "2020-03-19T17:52:23Z")

</div>

Thanks for that suggestion. Guess I gotta go read up on OSC, whatever that is 🙂

---

<div class="post-metadata">

**Author:** ![julianop](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@julianop](https://discourse.processing.org/u/julianop)\
**Post date:** [March 19, 2020, 5:54pm UTC](https://discourse.processing.org/t/communication-between-apps/18795/5 "2020-03-19T17:54:21Z")

</div>

Thanks also for the networking suggestion.  
Seems I wasn’t totally clear i my request, though: only one of the apps is a Processing app, the other is an in house app that could be adapted, if I know what Processing will support.

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [March 19, 2020, 8:09pm UTC](https://discourse.processing.org/t/communication-between-apps/18795/6 "2020-03-19T20:09:09Z")

</div>

> [@julianop](#):
>
> the other is an in house app

Just curious; the other would be in what language?

---

<div class="post-metadata">

**Author:** ![julianop](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@julianop](https://discourse.processing.org/u/julianop)\
**Post date:** [March 20, 2020, 12:31am UTC](https://discourse.processing.org/t/communication-between-apps/18795/7 "2020-03-20T00:31:23Z")

</div>

Good question, but actually I don’t know: it was written by a different division of the company. I’ll find out. Did you have something in mind that prompted the question?

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [March 20, 2020, 12:45am UTC](https://discourse.processing.org/t/communication-between-apps/18795/8 "2020-03-20T00:45:34Z")

</div>

Hehe, your answers leave more questions. Anyways everything is going mobile, and Android is, I believe, winning over IOS because of freedom when implementing IOT

---

<div class="post-metadata">

**Author:** ![julianop](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@julianop](https://discourse.processing.org/u/julianop)\
**Post date:** [March 20, 2020, 2:45am UTC](https://discourse.processing.org/t/communication-between-apps/18795/9 "2020-03-20T02:45:55Z")

</div>

Oh, there’s nothing mysterious or even mildly exciting, really 🙂 My request has nothing to do with mobile or IOT. it’s just that I want to extract some continuous data from an industrial data gathering tool and send it to a visualizer (graphic display) written in Processing. Both apps run on a Windows box.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [March 29, 2020, 4:51am UTC](https://discourse.processing.org/t/communication-between-apps/18795/10 "2020-03-29T04:51:40Z")

</div>

oscP5 should be perfect for that.

[http://www.sojamo.de/libraries/oscP5/](http://www.sojamo.de/libraries/oscP5/)

You can send or receive or both, but it sounds like your Processing sketch will just be a receiver.

It comes bundled with examples, and you can test the sending end with a second sketch to work out exactly what you want your tool will need to send.

---

<div class="post-metadata">

**Author:** ![julianop](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@julianop](https://discourse.processing.org/u/julianop)\
**Post date:** [March 29, 2020, 8:38pm UTC](https://discourse.processing.org/t/communication-between-apps/18795/11 "2020-03-29T20:38:23Z")

</div>

Thanks for the reply, Jeremy. Yes, in this initial case the Processing sketch will be receiving data, but my intention is eventually to send data back, if the stage one project is successful.  
I’ll go look up oscP5, run a couple of examples, and see how much trouble I can get myself into 😉  
I hope you don’t mind if I come back and ask for help if I get lost!
