Method: MPD#send_command
- Defined in:
- lib/ruby-mpd.rb
#send_command(command, *args) ⇒ true, ...
Used to send a command to the server, and to recieve the reply. Reply gets parsed. Synchronized on a mutex to be thread safe.
Can be used to get low level direct access to MPD daemon. Not recommended, should be just left for internal use by other methods.
207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/ruby-mpd.rb', line 207 def send_command(command, *args) raise ConnectionError, "Not connected to the server!" if !@socket @mutex.synchronize do begin @socket.puts convert_command(command, *args) response = handle_server_response return parse_response(command, response) rescue Errno::EPIPE reset_vars # kill the socket and reset raise ConnectionError, 'Broken pipe (got disconnected)' end end end |