|Subject:||Re: Socket Error #0 in TIdIOHandler.ReadFromSource|
|Posted by:||Remy Lebeau \(Indy Team\) (firstname.lastname@example.org)|
|Date:||Wed, 22 Aug 2007|
"Alex Ivlev" <email@example.com> wrote in message
> Bug: Indy improperly raises an exception EIdSocketError(0).
The only way EIdSocketError can be raised is if an actual socket error was
reported by the socket API.
> GMail doesn't respond after QUIT by whatever reason
> (but doesn't disconnect yet either).
It has to.
> CheckForSocketError is called with Result as its argument for some reason.
That has been fixed.
> I see at least two things wrong here:
> 1) using Result in CheckForSocketError call;
> 2) raising an exception when LLastError = 0.
LLastError being 0 is just a side effect of CheckForSocketError() being
called with the wrong parameter value. The fix is to pass in LByteCount
instead of Result. LLastError will not be 0 anymore.
CheckForSocketError() is designed to return the actual socket error that
occured. For CheckForSocketError() to be called in the first place,
LByteCount would have to had been < 0, which indicates a socket error
occured. When CheckForSocketError() is passed such a value, it will then
retreive the actual error code, raise an exception if it is not an ignorable
error (specified in the other parameter), and then return the error code for
the caller to use.
Socket Error #0 in TIdIOHandler.ReadFromSource posted by Alex Ivlev on Wed, 22 Aug 2007