Site Map Contact Us Home
E-mail Newsletter
Subscribe to get informed about
Clever Components news.

Your Name:
Your Email:
 
SUBSCRIBE
 
Previous Newsletters
 




Products Articles Downloads Order Support
Customer Portal      

Simple HTTP Server

Features | Detailed Description

The Simple HTTP Server is a component from the Clever Internet Suite library.

SimpleHttpServer works in the same thread as the main application thread runs. You can use it for accepting requests from clients and sending the corresponding responses.

Available in VCL edition.

Features:

  • Accept requests and send responses in the same application thread
  • Easy-to-use intuitive interface
  • Cookies support
  • UTF-8 support
  • Free one year upgrades and support

HTTP server in a few lines of source code

In only a few lines of source code, you can create a single-threaded Web server, accept requests and send responses.

// [Delphi]
port := simpleServer.Listen(80);
simpleServer.AcceptRequest(httpRequest);

if (simpleServer.RequestMethod = 'POST') and
   (simpleServer.RequestHeader.ContentType = 'application/x-www-form-urlencoded') then
begin
   simpleServer.ResponseVersion := hvHttp1_1;
   simpleServer.ResponseHeader.ContentType := 'application/json';
   simpleServer.KeepConnection := True;

   name := httpRequest.FormFields['name'].FieldValue
   simpleServer.SendResponse(200, 'OK', '{"your_name": "' + name + '"}');
end else
begin
   simpleServer.ResponseVersion := hvHttp1_1;
   simpleServer.ResponseHeader.ContentType := 'text/html';
   simpleServer.KeepConnection := True;

   simpleServer.SendResponse(200, 'OK', '<html><body>hello</body></html>');
end;

Complete Delphi source code

When Purchasing the Clever Internet Suite you receive the full sources for all suite components and also free unlimited support.

Interested?

    Copyright © 2000-2024