Welcome, Guest
Username: Password: Remember me
General discussions, feature requests for CodeTyphon Project and discussions that don't fit in any of the other specific CodeTyphon forum categories.
  • Page:
  • 1

TOPIC:

CT 2.70 problem Indy TCP Client component 11 years 9 months ago #2295

  • Maurizio
  • Maurizio's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 15
  • Thank you received: 0
this code not work (in CT 2.40 work correttly)

idTCPClient1.Host := 'ftp.webalice.it';
idTCPClient1.Port := 21;

IdTCPClient1.Disconnect;
IdTCPClient1.IOHandler.Free; //free Buffer otherwise .... Already Connected

try
idTCPClient1.Connect;

try
IdTCPClient1.IOHandler.WriteLn('Client message');
IdTCPClient1.IOHandler.ReadLn;
finally
IdTCPClient1.Disconnect;
end;

except
ShowMessage('Error ....');
end;

Please Log in or Create an account to join the conversation.

CT 2.70 problem Indy TCP Client component 11 years 9 months ago #2297

  • Maurizio
  • Maurizio's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 15
  • Thank you received: 0
execute idTCPClient1.Connect;
follow step by step with F7

the error is on the unit IdStackWindows on line 1235

{$IFDEF UNICODE_BUT_STRING_IS_ANSI}
LTemp := WideString(AHostName); // explicit convert to Unicode
{$ENDIF}
if UseIDNAPI then begin
1235 RetVal := getaddrinfo(PChar(IDNToPunnyCode(AHostName)), nil, @Hints, @LAddrInfo);
end else begin
RetVal := getaddrinfo(
{$IFDEF UNICODE_BUT_STRING_IS_ANSI}PWideChar(LTemp){$ELSE}PChar(AHostName){$ENDIF},
nil, @Hints, @LAddrInfo);
end;

Please Log in or Create an account to join the conversation.

CT 2.70 problem Indy TCP Client component 11 years 9 months ago #2305

  • Maurizio
  • Maurizio's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 15
  • Thank you received: 0
configuration Win7 64 CT 2.70 Lazarus Win32 BigIde

function IDNToPunnyCode(const AIDN : String) : String;
var
pPunycode : array [0..IDN_MAX_LENGTH] of WideChar;
Len : Integer;
begin
Result := '';
//
//ex. if AIDN is www.fpt.webalice.it
//the Len of conversion IdnToAscii result = 0
//
Len := IdnToAscii(0, PWideChar(AIDN), -1, pPunycode, IDN_MAX_LENGTH);
if (Len = 0) then begin
SysUtils.RaiseLastOSError;
end else begin
Result := PWideChar(@pPunycode);
end;
end;

Please Log in or Create an account to join the conversation.

  • Page:
  • 1