Old 16th February 2011, 16:15   #1
brentmj
Junior Member
 
Join Date: Feb 2011
Posts: 13
Finding out if an IP address is connected

I run a station on SAM and can take requests. The requests play automatically or if I'm around and monitoring the station, I will alter how the requests are played. If a request is old, I always pop over to the shoutcast admin page and make sure the listener that made the request is still connected before playing it. Otherwise I throw it out.

I would like for the automatic request handling to be able to do this as well. Is there a way to query the server via an HTTP request to find out if a particular IP is connected. Should I be listing this in the feature requests?

Thanks!
brentmj is offline   Reply With Quote
Old 16th February 2011, 16:30   #2
DrO
 
Join Date: Sep 2003
Posts: 27,873
at least with v2 DNAS (dunno about the v1), if you use the admin.cgi?sid=X&mode=viewxml&page=3 action (where X would be the stream id), then it will return an xml response like the following:
code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<SHOUTCASTSERVER>
<LISTENERS>
<LISTENER>
<HOSTNAME>192.168.2.3</HOSTNAME>
<USERAGENT>WinampMPEG/5.54</USERAGENT>
<CONNECTTIME>5</CONNECTTIME>
<POINTER>01E17684</POINTER>
<UID>01E17684</UID>
</LISTENER>
<LISTENER>
...
</LISTENER>
</LISTENERS>
</SHOUTCASTSERVER>

so if you can pull that, you should be able to easily do something that will parse it and see if the ip you're checking for exists.

-daz
DrO is offline   Reply With Quote
Old 16th February 2011, 16:58   #3
brentmj
Junior Member
 
Join Date: Feb 2011
Posts: 13
Unfortunately the host is using 1.9. Maybe I can convince them to upgrade....
brentmj is offline   Reply With Quote
Old 16th February 2011, 18:48   #4
dotme
Moderator
 
dotme's Avatar
 
Join Date: Feb 2005
Location: USA
Posts: 4,024
admin.cgi is available on 1.9 too - Log in, and you should see a link to XML Stats.
dotme is offline   Reply With Quote
Old 16th February 2011, 18:52   #5
DrO
 
Join Date: Sep 2003
Posts: 27,873
thanks for the clarification dotme (wasn't sure, i guess i should install a v1 DNAS at some point if only to see how it compares with admin stuff against v2).

-daz
DrO is offline   Reply With Quote
Old 16th February 2011, 20:18   #6
dotme
Moderator
 
dotme's Avatar
 
Join Date: Feb 2005
Location: USA
Posts: 4,024
Was in a hurry when I posted this morning. The URL format for a 1.x DNAS stats pull is:

http://x.x.x.x:zzzz/admin.cgi?pass=*******&mode=viewxml
dotme is offline   Reply With Quote
Old 17th February 2011, 05:18   #7
brentmj
Junior Member
 
Join Date: Feb 2011
Posts: 13
Thanks everybody. Now the question is whether or not it's worth it to parse that much XML in order to find one IP versus just going ahead and playing the request. I think maybe I will post in the feature requests as well.
brentmj is offline   Reply With Quote
Old 17th February 2011, 09:35   #8
DrO
 
Join Date: Sep 2003
Posts: 27,873
what could be done is just to have the xml output as say te following if an 'iponly' flag is passed on the action
code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<SHOUTCASTSERVER>
<LISTENERS>
<LISTENER>
<HOSTNAME>192.168.2.3</HOSTNAME>
</LISTENER>
<LISTENER>
<HOSTNAME>192.168.2.4</HOSTNAME>
</LISTENER>
<LISTENER>
...
</LISTENER>
</LISTENERS>
</SHOUTCASTSERVER>

so it could be easily accessed via http://serverip:Port/admin.cgi?pass=...age=3&iponly=1

that's about as much as i can see as being feasible to implement into a newer 2 DNAS release as anything else is just a bit too specific and i'm not too keen on adding in something for externally querying an ip.

[edit]
have implemented support for the &iponly=1 option for the next v2 DNAS release so it is there if you can get to use a newer DNAS on your hosting.

-daz
DrO is offline   Reply With Quote
Old 22nd February 2011, 13:59   #9
DrO
 
Join Date: Sep 2003
Posts: 27,873
have you had any chance to try things out with the newer v2 DNAS and the option added? (just curious).

-daz
DrO is offline   Reply With Quote
Old 22nd February 2011, 14:03   #10
brentmj
Junior Member
 
Join Date: Feb 2011
Posts: 13
Actually I have and what I saw was pretty cool, but I'm using SAM 4.7 to broadcast, and it officially doesn't play well with 2.0.
brentmj is offline   Reply With Quote
Old 22nd February 2011, 14:15   #11
DrO
 
Join Date: Sep 2003
Posts: 27,873
in what way isn't it playing well with the v2 DNAS?

-daz
DrO is offline   Reply With Quote
Old 22nd February 2011, 16:15   #12
brentmj
Junior Member
 
Join Date: Feb 2011
Posts: 13
Well, the first problem I ran into was the statistics gathering. I emailed for assistance and all I got back was that they don't support 2.0 but will in the next release. I can't remember how many years we've been waiting on the next release.
brentmj is offline   Reply With Quote
Old 22nd February 2011, 16:24   #13
DrO
 
Join Date: Sep 2003
Posts: 27,873
sounds similar to http://forums.winamp.com/showthread.php?t=327260

i've seen a few things saying there's meant to be SAM5 coming out this year though people probably thought the same about SC2 tools coming out, heh.

i have tried some aspects of SAM4 with the v2 DNAS and i know streaming worked ok though i never looked any further though if it is the same as the thread i linked to at the start of this post, then hopefully they will resolve things on their end as i'm really not keen on changing the summary page now.

-daz
DrO is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Shoutcast > Shoutcast Technical Support

Tags
http request, ip address

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump