[GH-ISSUE #8] Can't connect to socket file #538

Closed
opened 2026-05-22 23:58:26 +01:00 by JakeStanger · 1 comment
Owner

Originally created by @MonterraByte on GitHub (Oct 11, 2020).
Original GitHub issue: https://github.com/JakeStanger/mpd-discord-rpc/issues/8

I run mpd using a socket file (bind_to_address "~/.mpd/socket" in the mpd config file). This works fine for most applications, like Cantata, ncmpc, mpdris2, etc.

However, mpd-discord-rpc fails to connect. Here's my config file:

id = 677226551607033903
hosts = ["/home/username/.mpd/socket"]

[format]
details = "$title"
state = "$artist - $album"

I modified the try_get_mpd_conn function to print the error from MPDClient::connect instead of discarding it, and got this:

failed to lookup address information: Name or service not known
Originally created by @MonterraByte on GitHub (Oct 11, 2020). Original GitHub issue: https://github.com/JakeStanger/mpd-discord-rpc/issues/8 I run mpd using a socket file (`bind_to_address "~/.mpd/socket"` in the mpd config file). This works fine for most applications, like Cantata, ncmpc, mpdris2, etc. However, `mpd-discord-rpc ` fails to connect. Here's my config file: ``` id = 677226551607033903 hosts = ["/home/username/.mpd/socket"] [format] details = "$title" state = "$artist - $album" ``` I modified the `try_get_mpd_conn` function to print the error from `MPDClient::connect` instead of discarding it, and got this: ``` failed to lookup address information: Name or service not known ```
JakeStanger 2026-05-22 23:58:26 +01:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@JakeStanger commented on GitHub (Oct 11, 2020):

I think this might be a limitation of the upstream library. Perhaps I'm wrong, but the docs seem to indicate it only works over TCP. You might want to raise an issue there and see if they're willing to fix it. If not, I'll perhaps look into a different MPD library or something.

As an aside, would you mind creating a PR for your modification to try_get_mpd_conn? Swallowing errors sounds like a pain and I'd much rather it displayed them as you've got it doing.

<!-- gh-comment-id:706738340 --> @JakeStanger commented on GitHub (Oct 11, 2020): I think this might be a limitation of the [upstream library](https://github.com/kstep/rust-mpd). Perhaps I'm wrong, but [the docs](https://docs.rs/mpd/0.0.12/mpd/client/struct.Client.html#method.connect) seem to indicate it only works over TCP. You might want to raise an issue there and see if they're willing to fix it. If not, I'll perhaps look into a different MPD library or something. As an aside, would you mind creating a PR for your modification to `try_get_mpd_conn`? Swallowing errors sounds like a pain and I'd much rather it displayed them as you've got it doing.
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
JakeStanger/mpd-discord-rpc#538
No description provided.