[fpc-pascal] How to close TInetServer without except?
silvioprog
silvioprog at gmail.com
Thu May 2 19:57:32 CEST 2013
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, at Faddr, at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130502/5c41bbfe/attachment.html>
More information about the fpc-pascal
mailing list