WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: mpd via socket  (Read 3763 times)

Offline mb0

  • Jr. Member
  • **
  • Posts: 86
mpd via socket
« on: February 07, 2012, 05:18:37 PM »
I'm trying to connect to music player daemon via sockets, from the command line (yes, i know mpc exists). Its not something i'm familiar with, although i have got the same effect with php and fsockopen /fwrite.

There is a guide here*, however there is no '/home/USER/.mpd/socket' path, nor can i find one similar.
[*i assume the last line there is meant to be mpd not c.]

Could anyone help please?

Offline H.Lunke

  • Newbie
  • *
  • Posts: 9
Re: mpd via socket
« Reply #1 on: February 12, 2012, 02:17:07 PM »
Controlling 'mpd' via socket does not mean that you don't need a client any more, or that 'mpd' takes the role of a client itself. It's just another communications mechanism between the server and the client (which does not need to be 'mpc' of course).

The socket does not exist by itself, you can create it with following commands:
Code: [Select]
# mkdir /home/tc/.mpd/                       
# mkfifo /home/tc/.mpd/socket

You can verify the effect after having modified 'mpd.conf' and restarted 'mpd' using command 'netstat -an|grep LISTEN'. There won't be a LISTENING port on the address/port as before (something like: 0 0.0.0.0:6600) but now there will be a socket (something like: LISTENING      99401 /home/tc/.mpd/socket).

After pointing 'mpc' to use the socket via variable MPD_HOST you can then control the server via, for example: mpc add file.mp3, mpc play,.
Paradise is exactly like where you are right now -
only much, much better. [Laurie Anderson, Language is a virus]