# Is it possible to open/close OSC in processing?

**URL:** <https://discourse.processing.org/t/is-it-possible-to-open-close-osc-in-processing/2405>\
**Category:** Libraries\
**Created:** [August 6, 2018, 6:49am UTC](https://discourse.processing.org/t/is-it-possible-to-open-close-osc-in-processing/2405 "2018-08-06T06:49:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vapeur](https://avatars.discourse-cdn.com/v4/letter/v/f14d63/32.png) [@vapeur](https://discourse.processing.org/u/vapeur)\
**Post date:** [August 6, 2018, 6:49am UTC](https://discourse.processing.org/t/is-it-possible-to-open-close-osc-in-processing/2405/1 "2018-08-06T06:49:40Z")

</div>

Hi there, I am using oscP5 library to communicate from grasshopper to processing, but when the data is sent and saved, I’d like to close (and probably reopen) the OSC channel. is it possible? I tried with mousePressed() with a button, but not sure how to close OSC channel.

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [August 6, 2018, 5:43pm UTC](https://discourse.processing.org/t/is-it-possible-to-open-close-osc-in-processing/2405/2 "2018-08-06T17:43:14Z")

</div>

Try calling stop on your oscP5 object. That should do it.

Kf

---

<div class="post-metadata">

**Author:** ![vapeur](https://avatars.discourse-cdn.com/v4/letter/v/f14d63/32.png) [@vapeur](https://discourse.processing.org/u/vapeur)\
**Post date:** [August 7, 2018, 8:01am UTC](https://discourse.processing.org/t/is-it-possible-to-open-close-osc-in-processing/2405/3 "2018-08-07T08:01:17Z")

</div>

Thanks! it sure has a function to stop!..  
and I initiate it again to reopen?.

sorry for the stupid question…😅

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [August 7, 2018, 2:53pm UTC](https://discourse.processing.org/t/is-it-possible-to-open-close-osc-in-processing/2405/4 "2018-08-07T14:53:02Z")

</div>

I just got that info from looking at the source code. Stop is called everytime you exit your app as it is associated to the dispose method. In your case, you can use it to stop your connection. To restore the connection, you should use the same steps as creating one. I haven’t done that myself but it should work. Give it a try.

Kf

---

<div class="post-metadata">

**Author:** ![vapeur](https://avatars.discourse-cdn.com/v4/letter/v/f14d63/32.png) [@vapeur](https://discourse.processing.org/u/vapeur)\
**Post date:** [August 9, 2018, 5:54am UTC](https://discourse.processing.org/t/is-it-possible-to-open-close-osc-in-processing/2405/5 "2018-08-09T05:54:14Z")

</div>

I did exactly what you’ve said and it works perfectly. Thanks!
