[GH-ISSUE #91] Option for forcing port to listen on #79

Closed
opened 2026-02-27 19:28:43 +03:00 by kerem · 5 comments
Owner

Originally created by @sashahilton00 on GitHub (Jan 29, 2018).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/91

Issue by Robbiedobbie
Saturday Sep 23, 2017 at 11:11 GMT
Originally opened as https://github.com/plietar/librespot/issues/253


Currently, librespot listens on 5353 and a random port. This makes running it on a pc with firewall difficult. It would be nice if there was an option to select a specific port instead.

I've never programmed in rust before, so I haven't made a PR for it. Currently locally I solved it by simply putting my port instead of 0 in the following piece of code: TcpListener::bind(&"0.0.0.0:0".parse().unwrap(), handle)?;.

Originally created by @sashahilton00 on GitHub (Jan 29, 2018). Original GitHub issue: https://github.com/librespot-org/librespot/issues/91 <a href="https://github.com/Robbiedobbie"><img src="https://avatars0.githubusercontent.com/u/4340484?v=4" align="left" width="96" height="96" hspace="10"></img></a> **Issue by [Robbiedobbie](https://github.com/Robbiedobbie)** _Saturday Sep 23, 2017 at 11:11 GMT_ _Originally opened as https://github.com/plietar/librespot/issues/253_ ---- Currently, librespot listens on 5353 and a random port. This makes running it on a pc with firewall difficult. It would be nice if there was an option to select a specific port instead. I've never programmed in rust before, so I haven't made a PR for it. Currently locally I solved it by simply putting my port instead of 0 in the following piece of code: `TcpListener::bind(&"0.0.0.0:0".parse().unwrap(), handle)?;`.
kerem 2026-02-27 19:28:43 +03:00
Author
Owner

@ComlOnline commented on GitHub (Jan 29, 2018):

Runtime flag to be added

--zeroconf-port <int>
<!-- gh-comment-id:361326010 --> @ComlOnline commented on GitHub (Jan 29, 2018): Runtime flag to be added ``` --zeroconf-port <int> ```
Author
Owner

@sashahilton00 commented on GitHub (Jan 29, 2018):

This has been requested a few times, we should implement this as it's pretty trivial to do so. Runtime flag of --zeroconf-port suggested. Usage would be as follows: ./librespot --name "Librespot" --zeroconf-port 5353 one thing we must remember though is that any port number lower than 1024 are priviledged, so we should probably add some logic that rejects ports < 1024 and kicks out a warning that their chosen port has been ignored, then let the OS choose as it already does.

<!-- gh-comment-id:361326319 --> @sashahilton00 commented on GitHub (Jan 29, 2018): This has been requested a few times, we should implement this as it's pretty trivial to do so. Runtime flag of ```--zeroconf-port``` suggested. Usage would be as follows: ```./librespot --name "Librespot" --zeroconf-port 5353``` one thing we must remember though is that any port number lower than 1024 are priviledged, so we should probably add some logic that rejects ports < 1024 and kicks out a warning that their chosen port has been ignored, then let the OS choose as it already does.
Author
Owner

@michaelherger commented on GitHub (Jan 30, 2018):

In addition to allowing specification of the port to listen on, librespot should not die if it fails to open that port. IMHO an error message logged should be good enough.

(adding "mdns" to this comment as I keep searching for it and don't find this report :-))

<!-- gh-comment-id:361478133 --> @michaelherger commented on GitHub (Jan 30, 2018): In addition to allowing specification of the port to listen on, librespot should not die if it fails to open that port. IMHO an error message logged should be good enough. (adding "mdns" to this comment as I keep searching for it and don't find this report :-))
Author
Owner

@michaelherger commented on GitHub (Jan 30, 2018):

mdns is implemented using @plietar's own https://github.com/plietar/rust-mdns. I tried to change port by changing the hard-coded value in there to 5354. Unfortunately the Spotify client would no longer see it, as if it was expecting the service to run on 5353 and nothing else.

<!-- gh-comment-id:361660498 --> @michaelherger commented on GitHub (Jan 30, 2018): mdns is implemented using @plietar's own https://github.com/plietar/rust-mdns. I tried to change port by changing the hard-coded value in there to 5354. Unfortunately the Spotify client would no longer see it, as if it was expecting the service to run on 5353 and nothing else.
Author
Owner

@sashahilton00 commented on GitHub (Jan 30, 2018):

Implemented with the -z or the --zeroconf-port

<!-- gh-comment-id:361755992 --> @sashahilton00 commented on GitHub (Jan 30, 2018): Implemented with the ```-z``` or the ```--zeroconf-port```
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#79
No description provided.