Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Apr : Indy 10, Error in IdGlobalProtocols.pas, D6 and D2005...
| Subject: | Indy 10, Error in IdGlobalProtocols.pas, D6 and D2005... |
| Posted by: | "Jim Velasquez" (jim.velasqu..@gmail.com) |
| Date: | Sat, 9 Apr 2005 21:59:54 |
Over the last few weeks, I've been trying to build a simple TFTP server
using Indy10. I first tried on Delphi 6, and it appeared that the event
handlers in my app were never being called. I asked (probably poorly) here
for help, but no one was able to help me get it running.
I've been considering upgrading to Delphi 2005 anyway, so this past week I
went ahead and upgraded to D2005. I tried again at builting a simple TFTP
server application, and it fails similarly on D2005 using Indy 10.
I have further details on what is happening, which probably applies to both
Indy 10 for Delphi 6 as well as for Delphi 2005.
When I test my sample app by initiating a TFTP client request from a working
client application while running my simple server inside the Delphi
debugger, It appears that there is an error in IdGlobalProtocols.pas.
The debugger error is: "Project SimpleTFTPd.exe raised exception class
ERangeError with message 'Range Check Error'. "
The Call Stack has:
kernel32.RaiseException + 0x55 (this is the actual exception), then
StrToWord + $14.
It appears that the actual error is in IdGlobalProtocols.pas, in the
StrToWord function. In the copy of Indy installed in D2005, this is:
function StrToWord(const Value: String): Word;
begin
{$IFDEF DOTNET}
if Length(Value)>1 then
begin
Result := TwoCharToWord(Value[1],Value[2]);
end
else
begin
Result := 0;
end;
{$ELSE}
Result := Word(pointer(@Value[1])^);
{$ENDIF}
end;
I am trying to build a Win32 app in both cases, be it D6 or D2005.
I suspect the error is in the line Result := Word(pointer(@Value[1])^);
Any ideas?
Oh, and BTW, does anyone know how to rebuild installed packages like Indy
from within Delphi 2005?