c++protocolscustom-protocol

Connecting a desktop application with a website


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?


Solution

  • 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');