Use the idhttpserver control as the HTTP server

Source: Internet
Author: User

Some controls of C ++ Builder are packaged and directly used, which is really convenient. The following is what I implemented to receive HTTP requests.

1) Start the idhttpserver Service

Void _ fastcall tfrm_login: formcreate (tobject * sender)
{
Idhttpserver1-> active = true;
}

2) Add the following code to the idhttpserver1commandget event to receive HTTP requests.

Void _ fastcall tfrm_login: idhttpserver1commandget (tidpeerthread * athread,
Tidhttprequestinfo * requestinfo, tidhttpresponseinfo * responseinfo)
{
// Http: // 127.0.0.1: 80/time = 20112012 & Result = 1
Ansistring STR;
STR = requestinfo-> document;
G_logfile.print ("httpserver get string: % s \ n", STR );

}

3)

Start the program and enter IP addresses in the IE browser,

Print the result of the received request

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.