Pulseaudio networt port seems to be floating

I would like to use pulseaudio ability to send audio thought the network by playing from one computer and listen on another. This work fine but I have firewalls on all my computers including the raspberry pi that has patchbox os. On raspberry pi os and on other distro’s port 4713 is where pulseaudio listen on. But on patchbox os the port that pulseaudio listen on is floating it changes every time it starts. This means that I can not set rules for my firewall as the next time it’s restart the port number wouldn’t be the same. I would have to disable the firewall if I want to use this feature. So how can I set it to port 4713 or can there by an update to set it to 4713 or at least stop the port from changing.

Hey, there shouldn’t be anything special in Patchbox OS regarding this configuration - it’s not changed in any way during the image generation, and it itself is based on Raspbian Lite.

How did you configure this functionality? It looks like it’s disabled by default.

I installed pulseaudio-module-zeroconf. In file /etc/pulse/default.pa uncomment and added
load-module module-native-protocol-tcp auth-anonymous=1
load-module module-zeroconf-publish
with zeroconf setup the other computers on the network should see ports (sound device) are available. I used avahi discovery to see what network port pulseaudio is listening on

Try using port=4713 added to this line:

load-module module-native-protocol-tcp port=4713 auth-anonymous=1

Ok I try it no change. It has port for example 37337 that means that in pulseaudio no port is set at the point when it was compiled. I don’t see any documentation on how to set it after the fact. On the documentation on freedesktop.org website there are no option to set port

https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#module-native-protocol-unixtcp

Hi, I tried this on a fresh patchbox install, enabling the lines:

load-module module-native-protocol-tcp
load-module module-zeroconf-publish

Then after the Desktop booted, ran this command to see the port:

sudo lsof -i | grep pulse

The result shows port 4713 being used:

pulseaudi 1138   patch   34u  IPv6  21480      0t0  TCP *:4713 (LISTEN)
pulseaudi 1138   patch   35u  IPv4  21481      0t0  TCP *:4713 (LISTEN)

So it seems it’s fine. What output do you get using the lsof command?

I tried

sudo lsof -i | grep pulse

I got this

pulseaudi   928 patch   22u  IPv6  21519      0t0  TCP *:4713 (LISTEN)
pulseaudi   928 patch   23u  IPv4  21520      0t0  TCP *:4713 (LISTEN)
pulseaudi   928 patch   33u  IPv6  21532      0t0  TCP *:46087 (LISTEN)
pulseaudi   928 patch   34u  IPv4  21533      0t0  TCP *:45377 (LISTEN)

But the problem for me is that the port reported by avahi (zeroconf) is 46087 not 4713 and the other computers try to connect thought port 46087 and this port number change every time the computer that has patchbox os restarts. You can use avahi discovery to see the ports. If there is a way that I can get avavhi to report port number 4713 that might work.

I wonder why there’s more instances of pulseaudio running on your device? Is the configuration different in some other part?

If you have a spare SD card, you may try to replicate the setup on a fresh install and check if it’s behaving as expected. If it is, then you could try and compare the configuration files between the installs.

I tried a fresh copy of patchbox os on raspberry pi 4 on for some reason I can not get the keyboard to work. Tried it on raspi 3b+ and get port 4713 only. So I think this module is loaded twice

load-module module-native-protocol-tcp

So what I have done is commented out this line in /etc/pulse/default.pa and now I should have no network service for pulseaudio. But it still running this time only on port 4317. There are of few ways of setting options on pulseaudio you can use /etc/pulse/default.pa or set pulse using gui program. I had set pulse using both tring to get it working. Now I’m using default.pa and I can turn on the firewall. Thank’s but still have one more problem when it show the avaible sound sources on remote computers it doubles them. This wasn’t the case when I have the original problem.