[fpc-pascal] How to close TInetServer without except?

silvioprog silvioprog at gmail.com
Fri May 3 02:33:24 CEST 2013


2013/5/2 Zaher Dirkey <parmaja at gmail.com>

>
> On Thu, May 2, 2013 at 11:47 PM, silvioprog <silvioprog at gmail.com> wrote:
>
>> I tested current code on Linux, but unfortunately when I try to close,
>> the app stays locked. :|
>
>
> Yes headache :P
>
> Do not close, i use Shutdown
>
> function TmnSocket.DoShutdown(How: TmnShutdown): TmnError;
> const
>   cHow: array[TmnShutdown] of Integer = (0, SHUT_RD, SHUT_WR, SHUT_RDWR);
> var
>   c: Integer;
> begin
>   CheckActive;
>   c := fpshutdown(FHandle, cHow[How]);
>   if c = SOCKET_ERROR then
>   begin
>     Result := erFail;
> //    RaiseLastOSError; do not raise an error, maybe it is disconnected by
> the other side
>   end
>   else
>     Result := erNone;
> end;
>
> --
> I am using last revision of Lazarus, FPC 2.6 on Windows XP SP3
>
> Best Regards
> Zaher Dirkey
>

I tried with fpshotdown and closesocket, like this:

https://github.com/graemeg/freepascal/blob/master/packages/fcl-web/src/base/custfcgi.pp#L614

But, same error.

This is not the most serious problem. My dilemma now is to close the app. I
hate working with threads. -.-'

-- 
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130502/c69ed950/attachment.html>


More information about the fpc-pascal mailing list