-4

I'm developing C++ Application .I want to know how much time my application is executed . So after the treatement of my application I Add

system("start https://mydomain/stats.php" );

Behind this web page a script that calculate number of visitors . So even user execute my application, after the execution, it will open automatically this web page and increment +1 in number of visitors . But my manager doesn't agree with this solutions and ask me if I can do some thing but in background . Send to server a message to increment number of (persons who executes the application ). So can someone suggests an easy solution(more easier than programming socket ) .My problem seems like doing stat of visiting webpage but in my case It is C++ application not web application .

Amine
  • 1
  • 4
  • You can try working with [`boost-asio`](http://www.boost.org/doc/libs/1_65_0/doc/html/boost_asio/reference/). There are many approaches for doing what you want. – Blacktempel Aug 22 '17 at 11:48
  • Duplicate: https://stackoverflow.com/q/1011339/1717300 – hyde Aug 22 '17 at 11:50
  • 2
    What happens when the user is not on a network? What happens when the user is on an expensive 3G/4G network and not expecting your app to *call home*? – Mark Setchell Aug 22 '17 at 11:59
  • There are lots of concerns with making apps call home, especially if you are not clear to your users that you are doing so. Basic socket programming is likely the least of them. – Fire Lancer Aug 22 '17 at 12:27
  • @FireLancer If i have to implement socket .I would configure it in server and client side but .I don't have privilege to run script in Server . – Amine Aug 22 '17 at 12:53

1 Answers1

0

First of all, do you want to count the times the program is executed or do you want to count the actual persons using it ( or the nuber of installations)

The second thing is quite easy, you could count the times your program is downloaded, directly from the download page. That would probably not even need any changes in your application itself.

For the first one I advise you to ping a certain server or adress and then count the nuber of pings. ( if there is no web connection you could count the times of execution in the program and then ping as many times as needed when there is a connection) Then you would not need to run a web script.

  • Ping is not the good solution . Because , "Ping from client to server " can have succes from the third or fourth packet and then .I will be not able to count real number of execution . Number of downloads , it is not the good solution because , users can exchange the program with (hard drive ....) – Amine Aug 22 '17 at 12:04
  • Use TCP or such for the "ping" if you want to be slightly less concerned about loss packets. If you want to be really sure, generate a UUID for each execution and make the client wait for acknowledgement for either TCP or UDP (using a UUID allows you to check for certain double send issues where the "ack" packets all got lost) – Fire Lancer Aug 22 '17 at 12:25