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
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
How to get hash of entire...
by
Thaddy
[
Today
at 12:35:39 pm]
Developing a Kernel Modul...
by
nicolap
[
Today
at 12:15:10 pm]
IFS Fractals: Iterating t...
by
Dzandaa
[
Today
at 11:51:08 am]
Lazarus for Windows on aa...
by
AlexTP
[
Today
at 10:06:48 am]
Баги CYBERGRAPHICS AmigaO...
by
Smalovsky
[
Today
at 09:39:52 am]
C operators and shift
by
MarkMLl
[
Today
at 09:33:12 am]
fphttpapp and Windows Ser...
by
Thaddy
[
Today
at 08:36:36 am]
MIDI file generator - wor...
by
finlazarus
[
Today
at 02:49:40 am]
How do I use/call functio...
by
RedOctober
[
Today
at 02:43:07 am]
compiler messages suggest...
by
n7800
[
Today
at 02:35:05 am]
Interesting article about...
by
Bogen85
[
Today
at 01:06:10 am]
SAVE StringGrid to PDF
by
cdbc
[December 07, 2024, 06:52:33 pm]
How to turn off Antialias...
by
n7800
[December 07, 2024, 05:30:19 pm]
Record "inheritance"/stru...
by
Thaddy
[December 07, 2024, 05:22:24 pm]
TFPHttpClient timeout err...
by
Leledumbo
[December 07, 2024, 04:56:00 pm]
Tmemo add char like typin...
by
Thaddy
[December 07, 2024, 04:41:44 pm]
Beta Version of Super Gau...
by
lainz
[December 07, 2024, 04:09:32 pm]
Breakpoint dosn't work
by
Martin_fr
[December 07, 2024, 01:36:30 pm]
The Silver Coder on YouTu...
by
silvercoder70
[December 07, 2024, 12:56:29 pm]
FreePascal version of gcc...
by
Thaddy
[December 07, 2024, 12:53:59 pm]
LCL Web Native with D2Bri...
by
BlueIcaro
[December 07, 2024, 11:13:25 am]
(SOLVED)Arrow keys in FV
by
HotShoe
[December 07, 2024, 08:28:52 am]
Hustle - A simple task ma...
by
Wesbat
[December 07, 2024, 08:24:07 am]
Game Music Emulator
by
Guva
[December 07, 2024, 04:55:43 am]
Future Composer Player
by
Guva
[December 07, 2024, 04:42:57 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to terminate a THttpAplication? (Read 1021 times)
zen010101
Newbie
Posts: 4
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: 5755
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