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

Zaher Dirkey parmaja at gmail.com
Thu May 2 23:06:33 CEST 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130503/51875e4f/attachment.html>


More information about the fpc-pascal mailing list