Recent

Author Topic: autonomous web application  (Read 8627 times)

fhuvu

  • New member
  • *
  • Posts: 8
autonomous web application
« on: August 02, 2013, 01:48:41 am »
hello excuse for my bad English
lazarus can build cgis yeah, but I could write a web server and integrate in the application?, ie write a server capable of running your own application?, something like making php from version 5.2 incorporates their own server to run applications without apache
thanks

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12865
  • FPC developer.
Re: autonomous web application
« Reply #1 on: August 02, 2013, 09:54:44 am »
Yes. Just like any other TCP/IP server. There are various socket suites (Indy, lnet, Synapse) that support this.  SSL might be a bit more difficult, so if you need that, factor it into your decision.

Note that hooking ports under 1024 usually needs adminstrator rights.

see also http://indyproject.org

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: autonomous web application
« Reply #2 on: August 02, 2013, 10:28:33 am »
I seem to remember fpweb
http://wiki.lazarus.freepascal.org/fcl-web
has the ability to include a simple web server module (programmed in FPC) so your program does not need to depend on a web server.

I am not sure though.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: autonomous web application
« Reply #3 on: August 02, 2013, 03:27:19 pm »
If you install fpweb (fcl-web) it has http server application in the new project dialog. I'm using Brook for all my web needs, though. It's built on top of fcl-web but with more flexible structure and has more advanced features.

fhuvu

  • New member
  • *
  • Posts: 8
Re: autonomous web application
« Reply #4 on: August 02, 2013, 07:19:23 pm »
perhaps express myself badly. not want to use third-party modules framenworks not, let me know if I can create a cgi and integrate a server module and pascal freepascal only pure
Here's an example of pure application made ​​in another language, it is not what I want to do as I want to demonstrate pro
http://bitshare.com/files/izrmvvix/web-example.zip.html

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: autonomous web application
« Reply #5 on: August 02, 2013, 07:33:48 pm »
Yes, you can create a cgi application.

Read
http://wiki.lazarus.freepascal.org/fcl-web
for more details.

If you have more questions, perhaps posting in your native language as well as English may help?
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

kodok.buncit

  • New Member
  • *
  • Posts: 35
Re: autonomous web application
« Reply #6 on: August 02, 2013, 07:44:38 pm »
perhaps express myself badly. not want to use third-party modules framenworks not, let me know if I can create a cgi and integrate a server module and pascal freepascal only pure
Here's an example of pure application made ​​in another language, it is not what I want to do as I want to demonstrate pro
http://bitshare.com/files/izrmvvix/web-example.zip.html

fcl-web is not third party library its part of LCL and its pure object pascal. please refer to the link given by bigchimp for more info
kodok.buncit on github https://github.com/kodok-buncit/

Primary OS : Linux Ubuntu 12.04
fpc & laz      : always Trunk version

fhuvu

  • New member
  • *
  • Posts: 8
Re: autonomous web application
« Reply #7 on: August 02, 2013, 07:46:09 pm »
perfecto gracias, esto se parece a lo que yo quiero, prefiero que creo todo

fhuvu

  • New member
  • *
  • Posts: 8
Re: autonomous web application
« Reply #8 on: August 02, 2013, 08:44:18 pm »
http://wiki.lazarus.freepascal.org/fcl-web reading I realize that is not what I need, what I want is a full cgi but independent, requires no server, so I can incorporate a own server, the wiki shows how to create a cgi for apache but not independent, there is no way I will have to do it in c + +, thanks for everything

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: autonomous web application
« Reply #9 on: August 02, 2013, 09:05:25 pm »
I'm sorry but a cgi application is a cgi application. It doesn't depend on any particular web server.
Just compile the cgi application and follow your web server's instructions to install it.

If you read the wiki carefully you'll see it even mentions that Apache is used as an example; it is not necessary and another server can be used.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

fhuvu

  • New member
  • *
  • Posts: 8
Re: autonomous web application
« Reply #10 on: August 02, 2013, 09:08:46 pm »
I put an example here veanlo download it http://bitshare.com/files/izrmvvix/web-example.zip.html

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: autonomous web application
« Reply #11 on: August 02, 2013, 09:21:12 pm »
It seems you uploaded some kind of web server. (I'm not going to run it, sorry)
Now you can compile an fpweb cgi application and put the cgi where your web server expects the file to be.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

fhuvu

  • New member
  • *
  • Posts: 8
Re: autonomous web application
« Reply #12 on: August 02, 2013, 09:24:58 pm »
the file is safe, I have no own server, so I go up there, is an example of what I

fhuvu

  • New member
  • *
  • Posts: 8
Re: autonomous web application
« Reply #13 on: August 02, 2013, 09:32:29 pm »
after running it should go to localhost

kodok.buncit

  • New Member
  • *
  • Posts: 35
Re: autonomous web application
« Reply #14 on: August 02, 2013, 10:45:44 pm »
may be what fhuvu want is something like TFPHttpServer on unit fphttpserver please describe it to him  :D
here minimal demo on how to use THttpServer
Code: [Select]
program justtest;

{$mode objfpc}{$H+}

uses
  cthreads,
  sysutils,
  fphttpserver;
Type

  { TMyHttpServer }

  TMyHttpServer = class(TFPHttpServer)
  protected
    procedure HandleRequest(Var ARequest: TFPHTTPConnectionRequest;
                            Var AResponse : TFPHTTPConnectionResponse); override;
  end;

{ TMyHttpServer }

procedure TMyHttpServer.HandleRequest(var ARequest: TFPHTTPConnectionRequest;
  var AResponse: TFPHTTPConnectionResponse);
begin
  inherited HandleRequest(ARequest, AResponse);
  //handle your request here
  AResponse.Contents.add('Hello World im alive!');
end;

var
  MyServer : TMyHttpServer;
begin
  MyServer:=TMyHttpServer.Create(nil);
  try
    MyServer.Port := 9090;//listen on port 9090 (its up to you)
    MyServer.Active:= True;
  finally
    MyServer.Free;
  end;
end.

then point http://localhost:9090 on your browser
explore it to suite your need
« Last Edit: August 02, 2013, 10:58:53 pm by kodok.buncit »
kodok.buncit on github https://github.com/kodok-buncit/

Primary OS : Linux Ubuntu 12.04
fpc & laz      : always Trunk version

 

TinyPortal © 2005-2018