# Use only a single UDP port instead a big port range for media connection

**URL:** <https://mediasoup.discourse.group/t/use-only-a-single-udp-port-instead-a-big-port-range-for-media-connection/3328>\
**Category:** mediasoup libraries\
**Created:** [September 20, 2021, 11:26pm UTC](https://mediasoup.discourse.group/t/use-only-a-single-udp-port-instead-a-big-port-range-for-media-connection/3328 "2021-09-20T23:26:47Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![micaelgallego](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/micaelgallego/32/103_2.png) [@micaelgallego](https://mediasoup.discourse.group/u/micaelgallego)\
**Post date:** [September 21, 2021, 12:39am UTC](https://mediasoup.discourse.group/t/use-only-a-single-udp-port-instead-a-big-port-range-for-media-connection/3328/3 "2021-09-21T00:39:52Z")

</div>

Thank you @nazar-pc.

I’ve searched in the forum and I suppose I found the comments you mention:

The comment where single udp port is first mentioned is this one:

> [@Port in transport options](https://mediasoup.discourse.group/t/port-in-transport-options/2937/17):
>
> Some other sfu use only one udp port for all webrtc Connection They distinguish one udp packet belong to which connection by mapping the username of stun packet which exists in sdp with the remote udp ip and port does mediasoup consider adding the feature?

Here @vpalmisano proposes a prototype implementation here:

> [@Port in transport options](https://mediasoup.discourse.group/t/port-in-transport-options/2937/30):
>
> I’ve modified the @nazar-pc branch, allowing to listen to the same UDP port and use the STUN username to map the incoming UDP packets to the right WebRTC transport (taking some parts from [Webrtc sfu UDP single port solution design · UniverseParticle/mediasoup@cbe5e57 · GitHub](https://github.com/UniverseParticle/mediasoup/commit/cbe5e5713b202c40b009536213845856064a91d8)). More work is required to allow the cleanup of the listening socket objects when no more transports are using them. To try it, you have only to modify the mediasoup-demo config.js adding the webRtcTransportOptions.port op…

---

_[View the full topic](https://mediasoup.discourse.group/t/use-only-a-single-udp-port-instead-a-big-port-range-for-media-connection/3328)._
