Announcement

Collapse
No announcement yet.

Finding out if an IP address is connected

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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!

  • #2
    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
    WACUP Project <‖> "Winamp Ramblings" - Indie Winamp Dev Blog

    Comment


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

      Comment


      • #4
        admin.cgi is available on 1.9 too - Log in, and you should see a link to XML Stats.
        Atlantic Sound Factory
        Licensed by StreamLicensing | Powered by Fast Serv | Radionomy Broadcaster

        Comment


        • #5
          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
          WACUP Project <‖> "Winamp Ramblings" - Indie Winamp Dev Blog

          Comment


          • #6
            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
            Atlantic Sound Factory
            Licensed by StreamLicensing | Powered by Fast Serv | Radionomy Broadcaster

            Comment


            • #7
              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.

              Comment


              • #8
                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
                WACUP Project <‖> "Winamp Ramblings" - Indie Winamp Dev Blog

                Comment


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

                  -daz
                  WACUP Project <‖> "Winamp Ramblings" - Indie Winamp Dev Blog

                  Comment


                  • #10
                    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.

                    Comment


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

                      -daz
                      WACUP Project <‖> "Winamp Ramblings" - Indie Winamp Dev Blog

                      Comment


                      • #12
                        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.

                        Comment


                        • #13
                          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
                          WACUP Project <‖> "Winamp Ramblings" - Indie Winamp Dev Blog

                          Comment

                          Working...
                          X