Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Networking and Web Programming
»
How to terminate a THttpAplication?
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
[hacked for now] Changing...
by
jamie
[
Today
at 09:00:23 pm]
Error: Enumeration symbol...
by
tetrastes
[
Today
at 08:51:41 pm]
Access Violation - Databa...
by
1HuntnMan
[
Today
at 07:01:25 pm]
MVP made easier.
by
cdbc
[
Today
at 05:14:40 pm]
Lazarus is not working
by
Fred vS
[
Today
at 05:14:20 pm]
TIBDataSet "Closing"? on ...
by
RedOctober
[
Today
at 04:52:18 pm]
Recomendations for conver...
by
BlueIcaro
[
Today
at 04:44:57 pm]
Running External Tools
by
JuhaManninen
[
Today
at 04:08:28 pm]
Why does the call via fun...
by
jamie
[
Today
at 03:19:59 pm]
The start of yet another ...
by
TBMan
[
Today
at 03:16:21 pm]
Need help with Runcommand...
by
marcov
[
Today
at 12:46:25 pm]
Military Grade Directives
by
Thaddy
[
Today
at 11:46:44 am]
Cannot find Online Packag...
by
Thaddy
[
Today
at 11:37:58 am]
Anyone interested in help...
by
ad1mt
[
Today
at 08:56:20 am]
Hashing pointers by using...
by
440bx
[
Today
at 03:16:33 am]
exception external SIGSEG...
by
dseligo
[
Today
at 02:24:28 am]
[SOLVED] Is this a compil...
by
jamie
[
Today
at 01:46:54 am]
Problem installing LazPro...
by
peter.dell
[
Today
at 01:32:53 am]
AI interactions
by
Joanna
[December 13, 2025, 11:47:24 pm]
project - count source li...
by
bobonwhidbey
[December 13, 2025, 10:30:31 pm]
FPC 3.2.4-rc1 available
by
PeterBB
[December 13, 2025, 08:31:32 pm]
fpsockets error: 10047
by
parcel
[December 13, 2025, 04:03:56 pm]
So many "newbies"
by
Joanna
[December 13, 2025, 02:52:06 pm]
Is it possible to run "mo...
by
Thausand
[December 13, 2025, 02:42:56 pm]
TLazSerial : serial port ...
by
CM630
[December 13, 2025, 02:20:24 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to terminate a THttpAplication? (Read 1453 times)
zen010101
Newbie
Posts: 5
How to terminate a THttpAplication?
«
on:
July 17, 2024, 07:54:44 pm »
My program wants to exit normally after Ctrl-C is pressed, but I haven't been able to accomplish this under FPC 3.22/3.3.1. The following is a sample program fragment from the official (...\fpcsrc\packages\fcl-web\examples\httpapp, I only added the code to respond to Ctrl-C)
Code: Pascal
[Select]
[+]
[-]
procedure
signalHandler
(
signum
:
cint
)
;
cdecl
;
begin
if
(
signum
=
SIGTERM
)
or
(
signum
=
SIGINT
)
then
begin
Writeln
(
'Exiting'
)
;
Application
.
Terminate
;
// can not quit the application
//Raise Exception.Create('EXIT THE APPLICATION'); // this can exit the THttpApplication normally, you will see 'Done' output to the console.
end
;
end
;
begin
// Register SignalHandler
fpSignal
(
SIGINT
,
@
signalHandler
)
;
.
.
.
Application
.
Initialize
;
Application
.
Port
:
=
StrTointDef
(
ParamStr
(
2
)
,
8384
)
;
Application
.
Title
:
=
'HTTP Demo application'
;
Application
.
Run
;
Writeln
(
'Done'
)
;
end
.
I noticed a bug report which was committed 4 years ago (
https://gitlab.com/freepascal.org/fpc/source/-/issues/36741#original-reporter-info-from-mantis-luca-olivlucareporter-name-luca-olivetti
), but until now it is still there too.
«
Last Edit: July 20, 2024, 07:59:52 pm by zen010101
»
Logged
PascalDragon
Hero Member
Posts: 6238
Compiler Developer
Re: How to terminate a THttpAplication?
«
Reply #1 on:
July 18, 2024, 09:31:03 pm »
Quote from: zen010101 on July 17, 2024, 07:54:44 pm
```pascal
[...]
```
The forum does not use Markdown, but BBCodes, in this case [code=pascal][/code].
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Networking and Web Programming
»
How to terminate a THttpAplication?
TinyPortal
© 2005-2018