So, is the ScktComp.dcu actually compiled from the ScktComp.pas in the
source directory?
I have found that if I copy ScktComp.pas to my working directory, change the
name to ScktCompX.pas, change the unit name to ScktCompX. Then set my uses
clause to ScktCompX. Now if I recompile, I get ScktComp re-appear in my uses
clause, but it now works. Connecting to a non existing server does not
generate an application error.
This happens with Delphi 7 and Delphi 2005.
Any clues as to what is going on?
Graham
> I have found that if I copy ScktComp.pas to my working directory,
> change the name to ScktCompX.pas, change the unit name to
> ScktCompX. Then set my uses clause to ScktCompX.
You do not need to do that. You can, and should, leave the original name
as-is. That way, the file actually overrides the VCL. Otherwise, you have
two units sitting side-by-side, which is not very useful.
Gambit
Now I can trace the problem and it is becoming more mysterious.
Below is a section of code from ScktComp.pas
After the 10061 error is detected, we finally arrive here and call the Event
in the main application where the ErrorCode is set to 0. The application
error occurs upon execution of the END statement as indicated.
procedure TCustomSocket.Error(Socket: TCustomWinSocket; ErrorEvent:
TErrorEvent;
var ErrorCode: Integer);
begin
if Assigned(FOnError) then
FOnError(Self, Socket, ErrorEvent, ErrorCode);
end; //Application error occurs here
If I remove all the code from my event, the problem is still remains.
If I de-assign the event, all is fine as it skips past the FOnError call.
For debugging purposes I changed the above routine to the following:
procedure TCustomSocket.Error(Socket: TCustomWinSocket; ErrorEvent:
TErrorEvent;
var ErrorCode: Integer);
begin
if Assigned(FOnError) then
ClearTheWinsockError(ErrorCode);
end;
This works - no application error
I know that this is not a problem with the Client Socket component as I have
created a test application to do the same thing and there is no problem.
So somehow I am managing to corrupt something which causes the error.
Any clues much appreciated.
Graham
"Remy Lebeau (TeamB)" <no....@no.spam.com> wrote in message
news:438b...@newsgroups.borland.com...
For some reason this caused TClientSocket to give an application error if a
connection failed.
"Graham Powell" <gra...@deephaven.co.uk> wrote in message
news:438c...@newsgroups.borland.com...
> I did originally try what you suggested but failed to force
> Delphi to use the .pas rather than the existing .dcu
Did you disable the use of runtime packages? Delphi is specifically
designed to allow users to override the DCUs by including PAS files directly
into the project that use the same symbols as the DCUs. But it only works
if you do not use runtime packages.
Gambit
The problem turned out to be the following: If you have an IPWorks FTP
component on the same form as a Delphi TClientSocket and now you attempt to
make a connection from the TClientSocket to a non-existent server, an
application error will occur during the processing of the 10061 error.
If you remove the FTP component and all references to it in the uses clause,
the problem goes away.
Graham
"Remy Lebeau (TeamB)" <no....@no.spam.com> wrote in message
news:438cab68$1...@newsgroups.borland.com...