0

I made an application using Qt/C++ that reads some values every 5-7 seconds and sends them to a website.

My approach is very simple. I am just reading the values i want to send and then i make an HTTP POST to the website. I also send the username and password to the website.

The problem is that i cannot find out if the request is successful. I mean that if i send the request and server gets it, i will get an HTTP:200 always. For example if the password is not correct, there is no way to know it. It is the way HTTP works.

Now i think i will need some kind of a protocol to take care the communication between the application and the website.

The question is what protocol to use?

kechap
  • 2,077
  • 6
  • 28
  • 50

2 Answers2

0

if you can modify the server side script you could do the following

on one end : You can make the HTTP post request via ajax and evaluate the result of the ajax request.

On the serve side On the HTTP request you do your process and if everything goes accordingly you can send data back to the ajax script that called it.

solves your problem .. ?

Gaurav Shah
  • 5,223
  • 7
  • 43
  • 71
0

If the action performed completes before the response header is sent you have the option of adding a custom status to it. If your website is built on PHP you can call header() to add the custom status of the operation.

header('XAppRequest-Status: complete');
Captain Obvlious
  • 19,754
  • 5
  • 44
  • 74
  • You mean that if the authentication is made then i add a custom status to the response header? – kechap Jul 21 '11 at 11:10
  • @messkech Yes although I would suggest always including one to indicate either failure or success. I've updated my answer to clarify it. – Captain Obvlious Jul 21 '11 at 11:36