Professional Documents
Culture Documents
Today i was trying to find a solution to grab listeners number from shoutcast servers, but i needed a
something simple and to work with both versions of shoutcast. After a few tests i end up using the shoutcast
generated XML file.
Class StreamServer
Public ServerName As String
Public ServerAdress As String
Public ServerPassword As String
Public StreamID As String = 0
Public ListenersCount As Integer
Programming
And the function that gets the needed data:
Tutorials
VB.NET
Private Function Get_XMLFile(ByVal ServerID As Integer) As Integer
Dim wcMozilla As New WebClient Video Tutorials
Dim strResponse As String = Nothing
Try
''Add a compatible header
Pages
wcMozilla.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.2; .NET CLR 1.0.3705;)") Cookie Policy
Return MyServers.Item(ServerID).ListenersCount
End Function
I added a timer that calls the “Get_XMLFile” function every 15 seconds and counts the total listeners, which
is displayed on a label.
Imports System.Xml
Imports System.Net
Imports System.Text.RegularExpressions
https://www.radiodj.ro/programming/get-shoutcast-v1v2-listeners-number-in-vb-net.html 1/3
27/9/2019 Get Shoutcast v1/v2 listeners number in VB.NET | RadioDJ – Free Radio Automation Software
Imports System.IO
Class StreamServer
Public ServerName As String
Public ServerAdress As String
Public ServerPassword As String
Public StreamID As String = 0
Public ListenersCount As Integer
End Class
Try
''Add a compatible header
wcMozilla.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
Catch ex As WebException
'MsgBox(ex.Message)
Finally
End Try
End Try
Else
MyServers.Item(ServerID).ListenersCount = 0
End If
Return MyServers.Item(ServerID).ListenersCount
End Function
ListenerCount = 0
End Sub
End Class
The only drawnback of this approach is that you need to supply the admin password in order to reach the
shoucast XML.
No comments yet.
https://www.radiodj.ro/programming/get-shoutcast-v1v2-listeners-number-in-vb-net.html 2/3
27/9/2019 Get Shoutcast v1/v2 listeners number in VB.NET | RadioDJ – Free Radio Automation Software
Add a comment
You must be logged in to post a comment.
How To Add Hourly Playlists in PHP Scripts August 2016 database feeds
RadioDJ When Using External Programming July 2015 instalation install intro MariaDB
Music Schedulers?
How to import Internet Streams In
Tutorials February 2015 mysql overlay php plugin
https://www.radiodj.ro/programming/get-shoutcast-v1v2-listeners-number-in-vb-net.html 3/3