# InterProcessConnection from plugin on windows

**URL:** <https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072>\
**Category:** Audio Plugins\
**Created:** [December 6, 2023, 12:27pm UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072 "2023-12-06T12:27:15Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![chikashimiyama](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chikashimiyama/32/15762_2.png) [@chikashimiyama](https://forum.juce.com/u/chikashimiyama)\
**Post date:** [December 6, 2023, 12:27pm UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/1 "2023-12-06T12:27:15Z")

</div>

I’m trying to access InterprocessConnectionServer, running on a separate juce GUI application from my VST plugin running on a DAW (Reaper) using InterprocessConnection on Windows.

However, connectToSocket called on the plugin/client side always returns false.

It works properly when I run the same program on Mac or when I try to connect the server from a console application using InterprocessConnection on Windows.

What I found using the debugger is

> <https://github.com/juce-framework/JUCE/blob/d054f0d14dcac387aebda44ce5d792b5e7a625b3/modules/juce_core/network/juce_Socket.cpp#L281>

returns false when I try to access from a plugin but returns true when I access from a console app.  
But I’m not sure why the locking is not successful on a plugin and successful on a console app.

I would appreciate any help on this topic. Thank you.

---

<div class="post-metadata">

**Author:** ![chikashimiyama](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chikashimiyama/32/15762_2.png) [@chikashimiyama](https://forum.juce.com/u/chikashimiyama)\
**Post date:** [December 6, 2023, 2:32pm UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/2 "2023-12-06T14:32:03Z")

</div>

I just simply tried this on a AudioPluginAudioProcessor’s constructor and the locking failed.

```auto
AudioPluginAudioProcessor::AudioPluginAudioProcessor()
: AudioProcessor (BusesProperties()
                         .withInput ("Input", juce::AudioChannelSet::stereo(), true)
                         .withOutput ("Output", juce::AudioChannelSet::stereo(), true))
{
    const auto lock = juce::ScopedTryLock(criticalSection_);

    if(lock.isLocked())
    {
        DBG("locked successfully");
    }
    else
    {
        DBG("lock failed");
    }
}

```

---

<div class="post-metadata">

**Author:** ![chikashimiyama](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chikashimiyama/32/15762_2.png) [@chikashimiyama](https://forum.juce.com/u/chikashimiyama)\
**Post date:** [December 6, 2023, 4:48pm UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/3 "2023-12-06T16:48:22Z")

</div>

However, if I call directly TryEnterCriticalSection, it succeeds.

```auto
AudioPluginAudioProcessor::AudioPluginAudioProcessor()
: AudioProcessor (BusesProperties()
                         .withInput ("Input", juce::AudioChannelSet::stereo(), true)
                         .withOutput ("Output", juce::AudioChannelSet::stereo(), true))
{
    InitializeCriticalSection(&cs_);

    if (TryEnterCriticalSection(&cs_)) {
        std::cout << "Entered critical section" << std::endl;
        LeaveCriticalSection(&cs_);
    } else {
        std::cout << "Failed to enter critical section" << std::endl;
    }

    DeleteCriticalSection(&cs_);
}

```

---

<div class="post-metadata">

**Author:** ![anthony-nicholls](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/anthony-nicholls/32/1246_2.png) [@anthony-nicholls](https://forum.juce.com/u/anthony-nicholls)\
**Post date:** [December 6, 2023, 5:04pm UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/4 "2023-12-06T17:04:33Z")

</div>

Are you absolutely sure nothing else has the critical section? For example if you change the example to take a local critical section, does it still fail?

```auto
AudioPluginAudioProcessor::AudioPluginAudioProcessor()
: AudioProcessor (BusesProperties()
                         .withInput ("Input", juce::AudioChannelSet::stereo(), true)
                         .withOutput ("Output", juce::AudioChannelSet::stereo(), true))
{
    juce::CriticalSection localCriticalSection;
    const auto lock = juce::ScopedTryLock(localCriticalSection);

    if(lock.isLocked())
    {
        DBG("locked successfully");
    }
    else
    {
        DBG("lock failed");
    }
}

```

---

<div class="post-metadata">

**Author:** ![chikashimiyama](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chikashimiyama/32/15762_2.png) [@chikashimiyama](https://forum.juce.com/u/chikashimiyama)\
**Post date:** [December 6, 2023, 5:13pm UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/5 "2023-12-06T17:13:34Z")

</div>

Thank you for your reply.

I just copied your code and tested. my debugger stops at else clause. so yes, it still fail.  
My environment is Win 11. Reaper 6.81. I’m instanceating just one plugin instance on the session.

 ![Screenshot 2023-12-06 181106](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/6/f/6ff082f5a83cd6004d30c2bdd9f76608e8f0a360.png)

---

<div class="post-metadata">

**Author:** ![anthony-nicholls](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/anthony-nicholls/32/1246_2.png) [@anthony-nicholls](https://forum.juce.com/u/anthony-nicholls)\
**Post date:** [December 6, 2023, 5:42pm UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/6 "2023-12-06T17:42:08Z")

</div>

OK it seems likely something very odd is going on here. A couple of questions that you may or may not have answers too but could really help us.

- You don’t mention the JUCE version, does this happen on the latest version on the develop branch?
- Can you reproduce this using one of the example plugins?
- Just to understand the issue more does this happen if you do the same thing in the editors constructor rather than the processor?
- Can you update Windows 11 or have you recently updated Windows 11?
- Have you tried this on Windows 10?
- Have you tried any different machines?
- Have you tried a newer version of Reaper?
- Does this only happen on Reaper? if you have any other DAWs it might be nice to eliminate this.

Thanks.

---

<div class="post-metadata">

**Author:** ![chikashimiyama](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chikashimiyama/32/15762_2.png) [@chikashimiyama](https://forum.juce.com/u/chikashimiyama)\
**Post date:** [December 6, 2023, 6:05pm UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/7 "2023-12-06T18:05:43Z")

</div>

- Juce Version  
7.0.9
- Can you reproduce this using one of the example plugins?  
I’m testing it with the modified version of the example plugin I found under JUCE/examples/CMake/AudioPlugin
- Just to understand the issue more does this happen if you do the same thing in the editors constructor rather than the processor?  
Yes
- Have you tried this on Windows 10?  
No
- Have you tried any different machines?  
No, unfortunetely I don’t have any other machines at home.
- Have you tried a newer version of Reaper?  
No
- Does this only happen on Reaper?  
It happens also on Nuendo 10.3

---

<div class="post-metadata">

**Author:** ![chikashimiyama](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chikashimiyama/32/15762_2.png) [@chikashimiyama](https://forum.juce.com/u/chikashimiyama)\
**Post date:** [December 7, 2023, 9:45am UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/8 "2023-12-07T09:45:16Z")

</div>

@anthony-nicholls

Today I also tried on another Win 11 machine (note both my machine and another machine are using AMD CPU, I’m not sure if this is relevant).

On the other machine, I used the newer version of Reaper 7.0.6 and I can still reproduce the symptom. I cannot lock the thread.

---

<div class="post-metadata">

**Author:** ![anthony-nicholls](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/anthony-nicholls/32/1246_2.png) [@anthony-nicholls](https://forum.juce.com/u/anthony-nicholls)\
**Post date:** [December 7, 2023, 9:47am UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/9 "2023-12-07T09:47:53Z")

</div>

Thanks, that’s interesting we haven’t managed to reproduce the issue yet.

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [December 7, 2023, 9:56am UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/10 "2023-12-07T09:56:45Z")

</div>

If you change this line:

`const auto lock = juce::ScopedTryLock(localCriticalSection);`

to

`const juce::ScopedTryLock lock (localCriticalSection);`

do you get a different outcome?

I wonder if the initialization with “=” might result in the ScopedLock on the right of the = going out of scope when you copy it into the “lock” variable (just guessing, I don’t remember exactly what the standard says in this case).

---

<div class="post-metadata">

**Author:** ![anthony-nicholls](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/anthony-nicholls/32/1246_2.png) [@anthony-nicholls](https://forum.juce.com/u/anthony-nicholls)\
**Post date:** [December 7, 2023, 10:03am UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/11 "2023-12-07T10:03:00Z")

</div>

This crossed my mind too, the Curiously recurring C++ Bugs talk came to mind, but I couldn’t seem to reproduce an issue between the two styles myself. Definitely worth trying to eliminate any doubt though.

---

<div class="post-metadata">

**Author:** ![anthony-nicholls](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/anthony-nicholls/32/1246_2.png) [@anthony-nicholls](https://forum.juce.com/u/anthony-nicholls)\
**Post date:** [December 7, 2023, 10:08am UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/12 "2023-12-07T10:08:42Z")

</div>

Also the assignment operator should be both private and deleted so I assume in this case the assignment operator is never _actually_ called?

---

<div class="post-metadata">

**Author:** ![chikashimiyama](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chikashimiyama/32/15762_2.png) [@chikashimiyama](https://forum.juce.com/u/chikashimiyama)\
**Post date:** [December 7, 2023, 10:10am UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/14 "2023-12-07T10:10:52Z")

</div>

Tried that but it produces the same outcome

 ![Screenshot 2023-12-07 110847](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/b/a/bab471747c6ffa3b014976c789ad70797cc35b6d.png)

---

<div class="post-metadata">

**Author:** ![chikashimiyama](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chikashimiyama/32/15762_2.png) [@chikashimiyama](https://forum.juce.com/u/chikashimiyama)\
**Post date:** [December 7, 2023, 10:28am UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/15 "2023-12-07T10:28:30Z")

</div>

Installed Ableton Live 11 trial and tested on it. locking failed. so it probably doesn’t matter which DAW I use.

---

<div class="post-metadata">

**Author:** ![chikashimiyama](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chikashimiyama/32/15762_2.png) [@chikashimiyama](https://forum.juce.com/u/chikashimiyama)\
**Post date:** [December 7, 2023, 10:49am UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/16 "2023-12-07T10:49:55Z")

</div>

Tested on Windows 10 machine using Intel CPU, I can still reproduce the symptom.

---

<div class="post-metadata">

**Author:** ![chikashimiyama](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chikashimiyama/32/15762_2.png) [@chikashimiyama](https://forum.juce.com/u/chikashimiyama)\
**Post date:** [December 7, 2023, 11:28am UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/17 "2023-12-07T11:28:23Z")

</div>

@anthony-nicholls @yfede

Hey, I guess I found the cause. sorry, it’s my fault.  
I changed just one thing from the example plugin, and this produced the issue.

target\_compile\_definitions(CriticalSectionTest  
PUBLIC  
**VST3\_AUTO\_MANIFEST FALSE**  
JUCE\_WEB\_BROWSER=0  
JUCE\_USE\_CURL=0  
JUCE\_VST3\_CAN\_REPLACE\_VST2=0)

If I remove the line and let juce produce the moduleinfo, it worked properly.  
I thought this file (moduleinfo) just lets the DAW know the property of the plugin without loading the plugin. but seemingly, it influeves how the plugin is treated by the DAW… ?

---

<div class="post-metadata">

**Author:** ![anthony-nicholls](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/anthony-nicholls/32/1246_2.png) [@anthony-nicholls](https://forum.juce.com/u/anthony-nicholls)\
**Post date:** [December 7, 2023, 11:30am UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/18 "2023-12-07T11:30:12Z")

</div>

It’s nice to know things are working for you again but that still seems very surprising!

---

<div class="post-metadata">

**Author:** ![anthony-nicholls](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/anthony-nicholls/32/1246_2.png) [@anthony-nicholls](https://forum.juce.com/u/anthony-nicholls)\
**Post date:** [December 7, 2023, 11:41am UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/19 "2023-12-07T11:41:20Z")

</div>

@chikashimiyama just to be completely sure can you set it to false again and see if you can still reproduce the issue?

---

<div class="post-metadata">

**Author:** ![chikashimiyama](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chikashimiyama/32/15762_2.png) [@chikashimiyama](https://forum.juce.com/u/chikashimiyama)\
**Post date:** [December 7, 2023, 12:50pm UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/20 "2023-12-07T12:50:36Z")

</div>

Yes, I can reproduce.  
VST3\_AUTO\_MANIFEST TRUE → succeeded  
VST3\_AUTO\_MANIFEST FALSE → failed  
VST3\_AUTO\_MANIFEST TRUE → succeeded

---

<div class="post-metadata">

**Author:** ![chikashimiyama](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chikashimiyama/32/15762_2.png) [@chikashimiyama](https://forum.juce.com/u/chikashimiyama)\
**Post date:** [December 7, 2023, 12:53pm UTC](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072/21 "2023-12-07T12:53:35Z")

</div>

Also If I set VST3\_AUTO\_MANIFEST TRUE and remove moduleinfo file manualy from the .vst3 plugin. It still succeeds.

[Next page](https://forum.juce.com/t/interprocessconnection-from-plugin-on-windows/59072.md?page=2)
