How to stop a HttpApp via request?

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

How to stop a HttpApp via request?

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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

http.zip (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to stop a HttpApp via request?

Graeme Geldenhuys-3
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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to stop a HttpApp via request?

Michael Van Canneyt


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.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to stop a HttpApp via request?

Graeme Geldenhuys-3
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.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to stop a HttpApp via request?

silvioprog
In reply to this post by Graeme Geldenhuys-3
2013/9/24 Graeme Geldenhuys <[hidden email]>
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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to stop a HttpApp via request?

silvioprog
In reply to this post by Michael Van Canneyt
2013/9/24 Michael Van Canneyt <[hidden email]>
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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to stop a HttpApp via request?

silvioprog
In reply to this post by Graeme Geldenhuys-3
2013/9/24 Graeme Geldenhuys <[hidden email]>
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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to stop a HttpApp via request?

Michael Van Canneyt


On Wed, 25 Sep 2013, silvioprog wrote:

> 2013/9/24 Graeme Geldenhuys <[hidden email]>
>       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.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to stop a HttpApp via request?

silvioprog
2013/9/25 Michael Van Canneyt <[hidden email]>
On Wed, 25 Sep 2013, silvioprog wrote:
2013/9/24 Graeme Geldenhuys <[hidden email]>
      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.

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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to stop a HttpApp via request?

Reinier Olislagers
On 26/09/2013 16:01, silvioprog wrote:
> 2013/9/25 Michael Van Canneyt
> <[hidden email]
> <mailto:michael-y8GAwIkqPAJpn7uciFS/[hidden email]>>
>
>     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>
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to stop a HttpApp via request?

silvioprog
2013/9/26 Reinier Olislagers <[hidden email]>
On 26/09/2013 16:01, silvioprog wrote:
> 2013/9/25 Michael Van Canneyt
> <[hidden email]
> <mailto:[hidden email]/[hidden email]>>
>
>     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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to stop a HttpApp via request?

silvioprog
In reply to this post by Michael Van Canneyt
2013/9/25 Michael Van Canneyt <[hidden email]>
On Wed, 25 Sep 2013, silvioprog wrote:
2013/9/24 Graeme Geldenhuys <[hidden email]>
      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)
 
--
Silvio Clécio
My public projects - github.com/silvioprog

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to stop a HttpApp via request?

Michael Van Canneyt


On Sat, 5 Oct 2013, silvioprog wrote:

> 2013/9/25 Michael Van Canneyt <[hidden email]>
>       On Wed, 25 Sep 2013, silvioprog wrote:
>             2013/9/24 Graeme Geldenhuys <[hidden email]>
>                   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.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to stop a HttpApp via request?

DaWorm
Thumbs up.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal