[GH-ISSUE #1056] Librespot won't start on a custom port using --ap-port=xxxx #494

Closed
opened 2026-02-27 19:30:58 +03:00 by kerem · 4 comments
Owner

Originally created by @yanover on GitHub (Aug 31, 2022).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/1056

Describe the bug
I'm trying to run librespot on a specific port.

To reproduce
Steps to reproduce the behavior:

  1. Launch librespot with librespot --ap-port=4070
  2. Test ithe listening port
  3. The process is launch but the target port is a random one

Log

root@librespot-667cb86f5b-z2rj2:/# librespot --ap-port=4070 &
[2] 584
root@librespot-667cb86f5b-z2rj2:/# [2022-08-31T15:24:49Z INFO  librespot] librespot 0.4.2 6537c44 (Built on 2022-08-26, Build ID: eUmUV2Pm, Profile: release)

root@librespot-667cb86f5b-z2rj2:/# netstat -tulpn | grep LISTEN
tcp        0      0 0.0.0.0:41561           0.0.0.0:*               LISTEN      18/librespot        
tcp        0      0 0.0.0.0:34209           0.0.0.0:*               LISTEN      584/librespot       
tcp        0      0 0.0.0.0:44523           0.0.0.0:*               LISTEN      580/librespot  

Host (what you are running librespot on):

  • OS: Debian GNU/Linux 11 (bullseye)"
  • Platform: inside a k3s pod
Originally created by @yanover on GitHub (Aug 31, 2022). Original GitHub issue: https://github.com/librespot-org/librespot/issues/1056 **Describe the bug** I'm trying to run librespot on a specific port. **To reproduce** Steps to reproduce the behavior: 1. Launch `librespot` with `librespot --ap-port=4070` 2. Test ithe listening port 3. The process is launch but the target port is a random one 4. **Log** ``` root@librespot-667cb86f5b-z2rj2:/# librespot --ap-port=4070 & [2] 584 root@librespot-667cb86f5b-z2rj2:/# [2022-08-31T15:24:49Z INFO librespot] librespot 0.4.2 6537c44 (Built on 2022-08-26, Build ID: eUmUV2Pm, Profile: release) root@librespot-667cb86f5b-z2rj2:/# netstat -tulpn | grep LISTEN tcp 0 0 0.0.0.0:41561 0.0.0.0:* LISTEN 18/librespot tcp 0 0 0.0.0.0:34209 0.0.0.0:* LISTEN 584/librespot tcp 0 0 0.0.0.0:44523 0.0.0.0:* LISTEN 580/librespot ``` **Host (what you are running `librespot` on):** - OS: Debian GNU/Linux 11 (bullseye)" - Platform: inside a k3s pod
kerem 2026-02-27 19:30:58 +03:00
  • closed this issue
  • added the
    invalid
    label
Author
Owner

@kingosticks commented on GitHub (Aug 31, 2022):

<html>
  ap-port Connect to an AP with a specified port. If no AP with that port is present a fallback AP will be used. Available ports are usually 80, 443 and 4070.
</html>

That is the port of Spotify's Access Point you want to connect to, not the port librespot listens on.

I'm trying to run librespot on a specific port.

You can't do this. Librespot doesn't listen on any ports (other than for zeroconf). It connects to a Spotify Access Point server and communicates with other clients via this server.

EDIT: Actually, I can't' remember if this is true. Someone else can correct me here please.

<!-- gh-comment-id:1233098076 --> @kingosticks commented on GitHub (Aug 31, 2022): <html><body> <!--StartFragment-->   | ap-port | Connect to an AP with a specified port. If no AP with that port is present a fallback AP will be used. Available ports are usually 80, 443 and 4070. -- | -- | -- <!--EndFragment--> </body> </html> That is the port of Spotify's Access Point you want to connect to, not the port librespot listens on. > I'm trying to run librespot on a specific port. ~~You can't do this. Librespot doesn't listen on any ports (other than for zeroconf). It connects to a Spotify Access Point server and communicates with other clients via this server.~~ EDIT: Actually, I can't' remember if this is true. Someone else can correct me here please.
Author
Owner

@eladyn commented on GitHub (Aug 31, 2022):

There's --zeroconf-port, which sets the port that librespot listens on for zeroconf, which is probably what @yanover tries to do?

<!-- gh-comment-id:1233106773 --> @eladyn commented on GitHub (Aug 31, 2022): There's `--zeroconf-port`, which sets the port that `librespot` listens on for zeroconf, which is probably what @yanover tries to do?
Author
Owner

@yanover commented on GitHub (Aug 31, 2022):

Yes this is the option I was looking for, I missed it in the documentation, thank you !

What is not clear to me is which port my Spotify client will listen on.

If I create a service that listens on my pod's port 4070, which port(s) should be exposed outside of the cluster to my client ?

I found in different place that spotify-connect listen on port TCP and UDP port 57621, is that correct ?

<!-- gh-comment-id:1233117150 --> @yanover commented on GitHub (Aug 31, 2022): Yes this is the option I was looking for, I missed it in the documentation, thank you ! What is not clear to me is which port my Spotify client will listen on. If I create a service that listens on my pod's port 4070, which port(s) should be exposed outside of the cluster to my client ? I found in different place that spotify-connect listen on port `TCP and UDP port 57621`, is that correct ?
Author
Owner

@roderickvd commented on GitHub (Aug 31, 2022):

Not a bug. Feel free to chat on https://gitter.im/librespot-org/spotify-connect-resources.

<!-- gh-comment-id:1233272208 --> @roderickvd commented on GitHub (Aug 31, 2022): Not a bug. Feel free to chat on https://gitter.im/librespot-org/spotify-connect-resources.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#494
No description provided.