Hi,

I'm trying to close a socket (full code here:
https://bitbucket.org/silvioprog/tcpipcomp/src/6b43739d5416424e82112b858a9b71d26c8c6165/src/tcpipserver.pas?at=master
):

destructor TTcpIpServerSocketThread.Destroy;
begin
  FSocket.StopAccepting;
  FSocket.Free;
  inherited Destroy;
end;

But, it returns:

"Could not accept a client connection on socket: 288, error 10004"

The erros occurs just when I run my project on IDE. I noticed that error is
in this code:

Function TInetServer.Accept : Longint;

Var l : longint;

begin
  L:=SizeOf(FAddr);
  Result:=Sockets.fpAccept(Socket,@Faddr,@L);
  If Result<0 then
{$ifdef Unix}
    If SocketError=ESysEWOULDBLOCK then
      Raise ESocketError.Create(seAcceptWouldBlock,[socket])
    else
{$endif}
      Raise ESocketError.Create(seAcceptFailed,[Socket,SocketError]);
end;

The "Result" is returning -1, so, what I must do to it return 0? Overriding
in a descendant class of TInetServer?

-- 
Silvio Clécio
My public projects - github.com/silvioprog
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to