# OSC close port on exit

**URL:** <https://forum.cabbageaudio.com/t/osc-close-port-on-exit/661>\
**Category:** Cabbage slugs\
**Created:** [14 August 2017 07:12 UTC](https://forum.cabbageaudio.com/t/osc-close-port-on-exit/661 "2017-08-14T07:12:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oeyvind](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/oeyvind/32/4681_2.png) [@Oeyvind](https://forum.cabbageaudio.com/u/Oeyvind)\
**Post date:** [14 August 2017 07:12 UTC](https://forum.cabbageaudio.com/t/osc-close-port-on-exit/661/1 "2017-08-14T07:12:10Z")

</div>

When listening to OSC messages, we bind to a network port on init. It seems that this bind is not released when Cabbage stops Csound (before the score is finished). The situation arise when I have an OSC listener (OSCraw) in a plugin, use this plugin in a song in Reaper, close this song and then reopen it. When reopening I get a “bind failed” message from Csound (or no messages but it does not work). If I quit Reaper completely, then restarts Reaper and loads the song, it will work as expected again.

A simple example to test:

```
<Cabbage>
form caption("test"), size(330, 420), pluginID("tst1")
csoundoutput bounds(10, 10, 320, 400), text("Output")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n 
</CsOptions>
<CsInstruments>

instr 1
Smess[] init 32
ka = 0
Smess,ka OSCraw 9001
printk2 ka
endin

</CsInstruments>
<CsScore>
i 1 1 [3600*24*7]
</CsScore>
</CsoundSynthesizer>
```

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [14 August 2017 08:40 UTC](https://forum.cabbageaudio.com/t/osc-close-port-on-exit/661/2 "2017-08-14T08:40:43Z")

</div>

I’m seeing the same here, but I’m a little stumped on how to fix it. Let me dig around a little more. If I can’t find the problem I’ll get on to the Csound devs to see if they can help. Btw, I’m getting the same behavior even if the score finishes before before I remove the plugin.

[edit] I can recreate the problem outside of Cabbage using just Csound. I’ll post to the devs and see what they can do.
