# How does mediasoup determine a port is available could running sub-processes along side similar ports be okay?

**URL:** <https://mediasoup.discourse.group/t/how-does-mediasoup-determine-a-port-is-available-could-running-sub-processes-along-side-similar-ports-be-okay/2774>\
**Category:** mediasoup libraries\
**Created:** [May 8, 2021, 7:59am UTC](https://mediasoup.discourse.group/t/how-does-mediasoup-determine-a-port-is-available-could-running-sub-processes-along-side-similar-ports-be-okay/2774 "2021-05-08T07:59:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![BronzedBroth](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@BronzedBroth](https://mediasoup.discourse.group/u/BronzedBroth)\
**Post date:** [May 8, 2021, 7:59am UTC](https://mediasoup.discourse.group/t/how-does-mediasoup-determine-a-port-is-available-could-running-sub-processes-along-side-similar-ports-be-okay/2774/1 "2021-05-08T07:59:47Z")

</div>

Not sure how to ask, I apologize and if it’s been asked I apologize further!

I haven’t lurked or discovered how the port mechanism fully works and was wondering a few things specifically.

Can I run a secondary server-app next to the media-soup using similar ports and expect for them to not conflict? Two different apps, is this a problem? I guess this could be asked with pairing two media-soup servers without pipe-transport or workers but separated.

Hope this isn’t asked already and appreciate the help

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [May 8, 2021, 8:30am UTC](https://mediasoup.discourse.group/t/how-does-mediasoup-determine-a-port-is-available-could-running-sub-processes-along-side-similar-ports-be-okay/2774/2 "2021-05-08T08:30:02Z")

</div>

You can tell a port range to each Worker.  
BTW look at PortManager.cpp file if you want details.

---

<div class="post-metadata">

**Author:** ![BronzedBroth](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@BronzedBroth](https://mediasoup.discourse.group/u/BronzedBroth)\
**Post date:** [May 8, 2021, 8:33am UTC](https://mediasoup.discourse.group/t/how-does-mediasoup-determine-a-port-is-available-could-running-sub-processes-along-side-similar-ports-be-okay/2774/3 "2021-05-08T08:33:59Z")

</div>

I’ll peak that file, I neglected using workers so just individually starting the processes in PM2 one by one.  
Would it be bad if each process shared same port ranges? I could make two config files in this case but was wondering but off to peak. TY

---

<div class="post-metadata">

**Author:** ![BronzedBroth](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@BronzedBroth](https://mediasoup.discourse.group/u/BronzedBroth)\
**Post date:** [May 8, 2021, 8:38am UTC](https://mediasoup.discourse.group/t/how-does-mediasoup-determine-a-port-is-available-could-running-sub-processes-along-side-similar-ports-be-okay/2774/4 "2021-05-08T08:38:44Z")

</div>

Does this answer my question, saw the comment.  
// Here we already have a theorically available port. Now let’s check  
// whether no other process is binding into it.

So I could just run the one configuration file, give it insane ports and they’ll never bind on eachother goes for any and all processes media-soup or not? 😃

I think I like this.

_edit_  
This might be good information to include with the scalability/tricks; saw a few google hits when trying to sort how I’d ask.

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [May 8, 2021, 8:44am UTC](https://mediasoup.discourse.group/t/how-does-mediasoup-determine-a-port-is-available-could-running-sub-processes-along-side-similar-ports-be-okay/2774/5 "2021-05-08T08:44:25Z")

</div>

Yup, will consider adding that.

---

<div class="post-metadata">

**Author:** ![BronzedBroth](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@BronzedBroth](https://mediasoup.discourse.group/u/BronzedBroth)\
**Post date:** [May 8, 2021, 1:46pm UTC](https://mediasoup.discourse.group/t/how-does-mediasoup-determine-a-port-is-available-could-running-sub-processes-along-side-similar-ports-be-okay/2774/6 "2021-05-08T13:46:59Z")

</div>

So far working flawless, no hiccups. I wanted to be sure and it’s doing well, lots of users are able to join and fill up the site.
