Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-09

How to stop a HttpApp via request?

14 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

silvioprog

Hello,

I'm trying to stop a HTTP server via request. My code is:

http://pastebin.com/503S2Nin (or demo in attached)

But it returns:

"Could not accept a client connection on socket: -1; error 10004"

And generates leaks, but, If I comment this line:

//    App.Threaded := True;

It works fine.

How do I stop the socket before finishing my application?

Thank you!

Silvio Clécio My public projects - github.com/silvioprog

Reply by email

Graeme Geldenhuys
to silvioprog
silvioprog wrote
How do I stop the socket before finishing my application?

I've been unsuccessful with that myself, and mentioned it to Michael van Canneyt. I tried everything I could thing of, and nothing worked. I was using Windows. I haven't tested under Linux or FreeBSD yet.

In the mean time I switched my app to using Synapse's HTTP Server instead of the Free Pascal one. With Synapse and Indy components I can stop the HTTP Server without problems.

Regards,
Graeme

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 6 lines
On 23/09/13 21:03, silvioprog wrote: > How do I stop the socket before finishing my application? I've been unsuccessful with that myself, and mentioned it to Michael van Canneyt. I tried everything I could thing of, and nothing worked. I was using Windows. I haven't tested under Linux or FreeBSD yet.

I am working on it.

Michael.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt
Michael Van Canneyt wrote
I am working on it.

Thanks Michael.

btw: The fcl-web (and all your guidance) has worked wonders with my client side CGI application. The organisation of code and application flow is so much better. Thanks again for all your patience and help.

G.

Reply by email

silvioprog
to Graeme Geldenhuys: I've been unsuccessful with that myself, and mentioned it to Michael van Canneyt. I tried…

2013/9/24 Graeme Geldenhuys

Show quoted text 13 lines
On 23/09/13 21:03, silvioprog wrote: > How do I stop the socket before finishing my application? I've been unsuccessful with that myself, and mentioned it to Michael van Canneyt. I tried everything I could thing of, and nothing worked. I was using Windows. I haven't tested under Linux or FreeBSD yet. In the mean time I switched my app to using Synapse's HTTP Server instead of the Free Pascal one. With Synapse and Indy components I can stop the HTTP Server without problems. Regards, Graeme

I'm using Windows too.

In TcpIpComp (https://github.com/silvioprog/tcpipcomp) I had to add a property to indicate that the program was ending. This fixed the problem.

Silvio Clécio My public projects - github.com/silvioprog

Reply by email

silvioprog
to Michael Van Canneyt: I am working on it. Michael.

2013/9/24 Michael Van Canneyt

Show quoted text 15 lines
On Tue, 24 Sep 2013, Graeme Geldenhuys wrote: > On 23/09/13 21:03, silvioprog wrote: > >> How do I stop the socket before finishing my application? >> > > I've been unsuccessful with that myself, and mentioned it to Michael van > Canneyt. I tried everything I could thing of, and nothing worked. I was > using Windows. I haven't tested under Linux or FreeBSD yet. > I am working on it. Michael.

Thanks you Michael, I'll wait for this fix. (y)

Silvio Clécio My public projects - github.com/silvioprog

Reply by email

silvioprog
to Graeme Geldenhuys: Thanks Michael. btw: The fcl-web (and all your guidance) has worked wonders with my…

2013/9/24 Graeme Geldenhuys

Show quoted text 12 lines
On 24/09/13 10:46, Michael Van Canneyt wrote: > > I am working on it. Thanks Michael. btw: The fcl-web (and all your guidance) has worked wonders with my client side CGI application. The organisation of code and application flow is so much better. Thanks again for all your patience and help. G.

Before fcl-web with Brook framework I used PHP with Slim framework, now I rarely use PHP.

Thanks again guys! (y)

Silvio Clécio My public projects - github.com/silvioprog

Reply by email

Michael Van Canneyt
to silvioprog
silvioprog wrote 10 lines
2013/9/24 Graeme Geldenhuys On 24/09/13 10:46, Michael Van Canneyt wrote: > > I am working on it. Thanks Michael. btw: The fcl-web (and all your guidance) has worked wonders with my client side CGI application. The organisation of code and application flow is so much better. Thanks again for all your patience and help.

I had a look at

http://bugs.freepascal.org/view.php?id=24810

And applied the patches there, with some extra modifications.

I tested, and the server can now reliably be stopped without problems both in threaded or non threaded mode, from inside or outside a request.

Michael.

Reply by email

silvioprog
to Michael Van Canneyt

2013/9/25 Michael Van Canneyt

Show quoted text 24 lines
On Wed, 25 Sep 2013, silvioprog wrote: > 2013/9/24 Graeme Geldenhuys > On 24/09/13 10:46, Michael Van Canneyt wrote: > > > > I am working on it. > > Thanks Michael. > > btw: The fcl-web (and all your guidance) has worked wonders with my > client side CGI application. The organisation of code and application > flow is so much better. Thanks again for all your patience and help. > I had a look at http://bugs.freepascal.org/**view.php?id=24810<http://bugs.freepascal.org/view.php?id=24810> And applied the patches there, with some extra modifications. I tested, and the server can now reliably be stopped without problems both in threaded or non threaded mode, from inside or outside a request. Michael.

I need to test it, I'm waiting for the Lazarus team to update the snapshots (ftp://freepascal.dfmk.hu/pub/lazarus/snapshots) ...

Silvio Clécio My public projects - github.com/silvioprog

Reply by email

Reinier Olislagers
to silvioprog
silvioprog wrote 8 lines
2013/9/25 Michael Van Canneyt < > On Wed, 25 Sep 2013, silvioprog wrote: I need to test it, I'm waiting for the Lazarus team to update the snapshots (ftp://freepascal.dfmk.hu/pub/lazarus/snapshots <ftp://freepascal.dfmk.hu/pub/lazarus/snapshots/>) ...

Perhaps it's time to start using SVN to get up to date Lazarus and FPC?

You can do it manually...
<advertisement>
...or do it the simple way using fpcup - including a complete stand alone install of FPC+Lazuars, even Brook framework, if you want to ;) </advertisement>

Reply by email

silvioprog
to Reinier Olislagers

2013/9/26 Reinier Olislagers

Show quoted text 17 lines
On 26/09/2013 16:01, silvioprog wrote: > 2013/9/25 Michael Van Canneyt > < > > > > On Wed, 25 Sep 2013, silvioprog wrote: > I need to test it, I'm waiting for the Lazarus team to update the > snapshots (ftp://freepascal.dfmk.hu/pub/lazarus/snapshots > <ftp://freepascal.dfmk.hu/pub/lazarus/snapshots/>) ... Perhaps it's time to start using SVN to get up to date Lazarus and FPC? You can do it manually... <advertisement> ...or do it the simple way using fpcup - including a complete stand alone install of FPC+Lazuars, even Brook framework, if you want to ;) </advertisement>

Thank you Reinier, I'll try your solution too! :)

Silvio Clécio My public projects - github.com/silvioprog

Reply by email

silvioprog
to Michael Van Canneyt: I had a look at http://bugs.freepascal.org/view.php?id=24810 And applied the patches…

2013/9/25 Michael Van Canneyt

Show quoted text 24 lines
On Wed, 25 Sep 2013, silvioprog wrote: > 2013/9/24 Graeme Geldenhuys > On 24/09/13 10:46, Michael Van Canneyt wrote: > > > > I am working on it. > > Thanks Michael. > > btw: The fcl-web (and all your guidance) has worked wonders with my > client side CGI application. The organisation of code and application > flow is so much better. Thanks again for all your patience and help. > I had a look at http://bugs.freepascal.org/**view.php?id=24810<http://bugs.freepascal.org/view.php?id=24810> And applied the patches there, with some extra modifications. I tested, and the server can now reliably be stopped without problems both in threaded or non threaded mode, from inside or outside a request. Michael.

Worked like a charm. Thank you very much Michael! (y)

Silvio Clécio My public projects - github.com/silvioprog

Reply by email

Michael Van Canneyt
to silvioprog
silvioprog wrote 26 lines
2013/9/25 Michael Van Canneyt On Wed, 25 Sep 2013, silvioprog wrote: 2013/9/24 Graeme Geldenhuys       On 24/09/13 10:46, Michael Van Canneyt wrote:       >       > I am working on it. Thanks Michael. btw: The fcl-web (and all your guidance) has worked wonders with my client side CGI application. The organisation of code and application flow is so much better. Thanks again for all your patience and help. I had a look at http://bugs.freepascal.org/view.php?id=24810 And applied the patches there, with some extra modifications. I tested, and the server can now reliably be stopped without problems both in threaded or non threaded mode, from inside or outside a request. Michael. Worked like a charm. Thank you very much Michael! (y)

What does (y) mean ?

Michael.

Reply by email