Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   Shoutcast Technical Support (http://forums.winamp.com/forumdisplay.php?f=86)
-   -   Finding out if an IP address is connected (http://forums.winamp.com/showthread.php?t=327431)

brentmj 16th February 2011 15:15

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!

DrO 16th February 2011 15:30

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

brentmj 16th February 2011 15:58

Unfortunately the host is using 1.9. Maybe I can convince them to upgrade....

dotme 16th February 2011 17:48

admin.cgi is available on 1.9 too - Log in, and you should see a link to XML Stats.

DrO 16th February 2011 17:52

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

dotme 16th February 2011 19:18

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

brentmj 17th February 2011 04:18

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.

DrO 17th February 2011 08:35

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 22nd February 2011 12:59

have you had any chance to try things out with the newer v2 DNAS and the option added? (just curious).

-daz

brentmj 22nd February 2011 13:03

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.

DrO 22nd February 2011 13:15

in what way isn't it playing well with the v2 DNAS?

-daz

brentmj 22nd February 2011 15:15

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.

DrO 22nd February 2011 15:24

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


All times are GMT. The time now is 15:55.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.