tags:

views:

92

answers:

6

Despite my lack of coding knowledge I managed to write a small little app in VB net that a lot of people are now using. Since I made it for free I have no way of knowing how popular it really is and was thinking I could make it ping some sort of online stat counter so I could figure out if I should port it to other languages. Any idea of how I could ping a url via vb without actually opening a window or asking to receive any data? When I google a lot of terms for this I end up with examples with 50+ lines of code for what I would think should only take one line or so, similar to opening an IE window.

Side Note: Would of course fully inform all users this was happening.

+1  A: 

Might be easier to track downloads (assuming people are getting this via HTTP) instead of installs. Otherwise, add a "register now?" feature.

Terry Lorber
+2  A: 

Just a sidenote: You should inform your users that you are doing this (or not do it at all) for privacy concerns. Even if you aren't collecting any personal data it can be considered a privacy problem. For example, when programs collect usage information, they almost always have a box in the installation process asking if the user wants to participate in an "anonymous usage survey" or something similar. What if you just tracked downloads?

Martin W
A: 

.NET? Create an ASMX Web Service and set it up on your web site. Then add the service reference to your app.

EDIT/CLARIFICATION: Your Web Service can then store passed data into a database, instead of relying on Web Logs: Installation Id, Install Date, Number of times run, etc.

Tom Carr
+1  A: 

You could use something simple in the client app like

Sub PingServer(Server As String, Port As Integer)
  Dim Temp As New System.Net.Sockets();
  Temp.Connect(Server, Port)
  Temp.Close()
End Sub

Get your webserver to listen on a particular port and count connections.

Also, you really shouldn't do this without the user's knowledge, so as others have said, it would be better to count downloads, or implement a registration feature.

Vincent McNabb
A: 

The guys over at vbdotnetheaven.com have a simple example using the WebClient, WebRequest and HttpWebRequest classes. Here is their WebClient class example:

Imports System
Imports System.IO
Imports System.Net
Module Module1 
   Sub Main()
      ' Address of URL
      Dim URL As String = http://www.c-sharpcorner.com/default.asp
      ' Get HTML data
      Dim client As WebClient = New WebClient()
      Dim data As Stream = client.OpenRead(URL)
      Dim reader As StreamReader = New StreamReader(data)
      Dim str As String = ""
      str = reader.ReadLine()
      Do While str.Length > 0
         Console.WriteLine(str)
         str = reader.ReadLine()
      Loop
   End Sub
End Module
JohnnyLambada
+1  A: 

I assume you are making this available via a website. So you could just ask people to give you their email address in order to get the download link for the installer. Then you can track how many people add themselves to your email list each month/week/etc. It also means you can email them all when you make a new release so that they can keep up to date with the latest and greatest.

Note: Always ensure they have an unsubscribe link at the end of each email you send them.

Phil Wright