O
Osuka Adartse
I have a question regarding sockets, I'm trying to use the HttpQ plugin
so open a socket to host x at 4800 plus passwd, and send commands, so
far so good(commands working), but I'm having trouble figuring how to
read the returned code.
All I keep getting is:"HTTP/1.0 200 OK\r\nServer: Winamp httpQ Plugin
Version 2.1\r\nContent-Type: text/html\r\n\r\n"
at the end of this string there should be a return code like:
" 1" or " 5353. Singyguy - sillysong"
but there's nothing, so anybody have an idea how to do this?
-some code-
require 'socket'
passw='*****'
hostname='localhost'
port=4800
sock=TCPSocket.new(hostname,port)
sock.send("GET /PLAY?p=#{passw} HTTP/1.0\r\n\r\n",0)
#executes the command, but no return code,there should be an 1 at the
end of the str
puts sock.recv(128).inspect
#=>"HTTP/1.0 200 OK\r\nServer: Winamp httpQ Plugin Version
2.1\r\nContent-Type: text/html\r\n\r\n"
sock.send("GET /GETCURRENTTITLE?p=#{@passw}&a=1 HTTP/1.0\r\n\r\n",0)
puts sock.recv(128).inspect #=> should return something like:
#=>"HTTP/1.0 200 OK\r\nServer: Winamp httpQ Plugin Version
2.1\r\nContent-Type: text/html\r\n\r\n" 2080. Artist - Song Name"
#but gives me: *notice no " 2080. Artist - Song Name"
#=>"HTTP/1.0 200 OK\r\nServer: Winamp httpQ Plugin Version
2.1\r\nContent-Type: text/html\r\n\r\n"
So I should receive the above string *plus* the return code, but ain't
getting the last. Any help is appreciated.
if it helps
Socket.getaddrinfo('localhost', 4800)#=>AF_INET, 4800, adartse,
127.0.0.1, 2, 2, 17
samples of code to use httpq, I'm looking at php's since I knew a
bit(and forgeting fast, thanks to ruby)
http://www.kostaa.com/winamp/sample.html
sorry for the long lines
*Adartse*
so open a socket to host x at 4800 plus passwd, and send commands, so
far so good(commands working), but I'm having trouble figuring how to
read the returned code.
All I keep getting is:"HTTP/1.0 200 OK\r\nServer: Winamp httpQ Plugin
Version 2.1\r\nContent-Type: text/html\r\n\r\n"
at the end of this string there should be a return code like:
" 1" or " 5353. Singyguy - sillysong"
but there's nothing, so anybody have an idea how to do this?
-some code-
require 'socket'
passw='*****'
hostname='localhost'
port=4800
sock=TCPSocket.new(hostname,port)
sock.send("GET /PLAY?p=#{passw} HTTP/1.0\r\n\r\n",0)
#executes the command, but no return code,there should be an 1 at the
end of the str
puts sock.recv(128).inspect
#=>"HTTP/1.0 200 OK\r\nServer: Winamp httpQ Plugin Version
2.1\r\nContent-Type: text/html\r\n\r\n"
sock.send("GET /GETCURRENTTITLE?p=#{@passw}&a=1 HTTP/1.0\r\n\r\n",0)
puts sock.recv(128).inspect #=> should return something like:
#=>"HTTP/1.0 200 OK\r\nServer: Winamp httpQ Plugin Version
2.1\r\nContent-Type: text/html\r\n\r\n" 2080. Artist - Song Name"
#but gives me: *notice no " 2080. Artist - Song Name"
#=>"HTTP/1.0 200 OK\r\nServer: Winamp httpQ Plugin Version
2.1\r\nContent-Type: text/html\r\n\r\n"
So I should receive the above string *plus* the return code, but ain't
getting the last. Any help is appreciated.
if it helps
Socket.getaddrinfo('localhost', 4800)#=>AF_INET, 4800, adartse,
127.0.0.1, 2, 2, 17
samples of code to use httpq, I'm looking at php's since I knew a
bit(and forgeting fast, thanks to ruby)
http://www.kostaa.com/winamp/sample.html
sorry for the long lines
*Adartse*