Problem about Indy 10, IdTelnet component in Delphi 2009

Dear all:

        I make a simple test telnet program communicate with a linux server , through Idtelnet component , I specify the host property with a server ip, use a button  to connect to the server . and display the welcome message in a memo . code as blew :

procedure TForm1.Button1Click(Sender: TObject);
begin
  Telnet.Connect;
end;

procedure TForm1.TelnetDataAvailable(Sender: TIdTelnet; const Buffer: string);
begin
  Memo1.Lines.Add(Buffer);
end;

       But when I click the button , the message displayed in the memo is like " }} }#}' ", not the normal message as "Red Hat Enterprise Linux AS release 4 (Nahant Update 4) ... "

       Such code can be tested successfully by Delphi 6 / Indy 9 , Would anyone like to help me , thanks .
0
Landman
2/20/2009 2:21:25 AM
embarcadero.delphi.tools 5366 articles. 3 followers. Follow

13 Replies
1729 Views

Similar Articles

[PageSpeed] 31

can anyone help me ?

does this problem related to the charset ( my client with Chinese Simplified Language ) ?

I have download and update the latest version (10.5.5) of indy but the problem still there  -_-"
0
Landman
2/20/2009 5:57:01 AM
<Landman Lee> wrote in message news:83332@forums.codegear.com...

> the message displayed in the memo is like " }} }#}' ", not
> the normal message as "Red Hat Enterprise Linux AS release 4
> (Nahant Update 4) ... "

TIdTelnet has not been updated yet to account for the Unicode changes in 
D2009.

>       Such code can be tested successfully by Delphi 6 / Indy 9

In older versions, the Buffer parameter of the OnDataAvailable event was an 
AnsiString.  In D2009, it is a UnicodeString.  But TIdTelnet is stuffing raw 
bytes into that UnicodeString instead of converting them to Unicode first.

-- 
Remy Lebeau (TeamB)
0
Remy
2/20/2009 7:08:12 PM
<Landman Lee> wrote in message news:83360@forums.codegear.com...

> can anyone help me ?

You need to be more patient.  Only 3 hours had passed before you posted 
again.  Please wait 1-2 days for people to have time to reply before posting 
again.

-- 
Remy Lebeau (TeamB)
0
Remy
2/20/2009 7:09:51 PM
<Landman Lee> wrote in message news:83332@forums.codegear.com...

>       But when I click the button , the message displayed in the memo
> is like " }} }#}' ", not the normal message as "Red Hat
> Enterprise Linux AS release 4 (Nahant Update 4) ... "

A quick-n-dirty solution would be to alter IdTelnet.pas to make 
TIdTelnetReadThread.HandleIncomingData() pass Indy's 8-bit encoding class to 
TIdIOHandler.InputBufferAsString(), ie:

{code:delphi}
procedure TIdTelnetReadThread.HandleIncomingData;
begin
  // old code:
  // FClient.Negotiate(FClient.IOHandler.InputBufferAsString);
  FClient.Negotiate(FClient.IOHandler.InputBufferAsString(Get8BitEncoding));
  // or:
  // FClient.Negotiate(FClient.IOHandler.InputBufferAsString(en8Bit));
end;
{code}

The long term solution will be to re-write TIdTelnet to not process inbound 
data using String values at all.

-- 
Remy Lebeau (TeamB)
0
Remy
2/20/2009 7:46:10 PM
Dear Remy Lebeau :

      Thank you for your attention , I will be more patient later ^_^
      I just test your quick-n-dirty solution . I have modify the "TIdTelnetReadThread.HandleIncomingData " , rebuild the IndyProtocols package and re-install it, but when I test the original program , I got the same result as before . anything else do I need to do ?
0
Landman
2/23/2009 9:38:05 AM
<Landman Lee> wrote in message news:84230@forums.codegear.com...

>      I just test your quick-n-dirty solution . I have modify the
> "TIdTelnetReadThread.HandleIncomingData " , rebuild the
> IndyProtocols package and re-install it, but when I test the
> original program , I got the same result as before . anything
> else do I need to do ?

Can you capture the raw server data using a packet sniffer, such as 
Wireshark, and then post it for testing?  Or is there a public server online 
that reproduces the same problem?

-- 
Remy Lebeau (TeamB)
0
Remy
2/23/2009 7:01:44 PM
Dear Remy Lebeau:

        This is the log export from Wireshark , I've flitered the telnet message:

No.     Time        Source                Destination           Protocol Info
    112 14.012143   192.168.100.17        192.168.100.170       TELNET   Telnet Data ...

Frame 112 (66 bytes on wire, 66 bytes captured)
    Arrival Time: Feb 24, 2009 12:34:57.709599000
    [Time delta from previous captured frame: 0.003984000 seconds]
    [Time delta from previous displayed frame: 14.012143000 seconds]
    [Time since reference or first frame: 14.012143000 seconds]
    Frame Number: 112
    Frame Length: 66 bytes
    Capture Length: 66 bytes
    [Frame is marked: False]
    [Protocols in frame: eth:ip:tcp:telnet]
    [Coloring Rule Name: TCP]
    [Coloring Rule String: tcp]
Ethernet II, Src: Elitegro_60:5e:56 (00:16:ec:60:5e:56), Dst: Wistron_3c:fc:e8 (00:16:d3:3c:fc:e8)
    Destination: Wistron_3c:fc:e8 (00:16:d3:3c:fc:e8)
        Address: Wistron_3c:fc:e8 (00:16:d3:3c:fc:e8)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
    Source: Elitegro_60:5e:56 (00:16:ec:60:5e:56)
        Address: Elitegro_60:5e:56 (00:16:ec:60:5e:56)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
    Type: IP (0x0800)
Internet Protocol, Src: 192.168.100.17 (192.168.100.17), Dst: 192.168.100.170 (192.168.100.170)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x10 (DSCP 0x04: Unknown DSCP; ECN: 0x00)
        0001 00.. = Differentiated Services Codepoint: Unknown (0x04)
        .... ..0. = ECN-Capable Transport (ECT): 0
        .... ...0 = ECN-CE: 0
    Total Length: 52
    Identification: 0x08d2 (2258)
    Flags: 0x04 (Don't Fragment)
        0... = Reserved bit: Not set
        .1.. = Don't fragment: Set
        ..0. = More fragments: Not set
    Fragment offset: 0
    Time to live: 64
    Protocol: TCP (0x06)
    Header checksum: 0xe7d5 [correct]
        [Good: True]
        [Bad : False]
    Source: 192.168.100.17 (192.168.100.17)
    Destination: 192.168.100.170 (192.168.100.170)
Transmission Control Protocol, Src Port: telnet (23), Dst Port: 4248 (4248), Seq: 1, Ack: 1, Len: 12
    Source port: telnet (23)
    Destination port: 4248 (4248)
    [Stream index: 12]
    Sequence number: 1    (relative sequence number)
    [Next sequence number: 13    (relative sequence number)]
    Acknowledgement number: 1    (relative ack number)
    Header length: 20 bytes
    Flags: 0x18 (PSH, ACK)
        0... .... = Congestion Window Reduced (CWR): Not set
        .0.. .... = ECN-Echo: Not set
        ..0. .... = Urgent: Not set
        ...1 .... = Acknowledgement: Set
        .... 1... = Push: Set
        .... .0.. = Reset: Not set
        .... ..0. = Syn: Not set
        .... ...0 = Fin: Not set
    Window size: 5840 (scaled)
    Checksum: 0x1ac8 [validation disabled]
        [Good Checksum: False]
        [Bad Checksum: False]
    [SEQ/ACK analysis]
        [This is an ACK to the segment in frame: 111]
        [The RTT to ACK the segment was: 0.003984000 seconds]
        [Number of bytes in flight: 12]
Telnet
    Command: Do Terminal Type
    Command: Do Terminal Speed
    Command: Do X Display Location
    Command: Do New Environment Option

0000  00 16 d3 3c fc e8 00 16 ec 60 5e 56 08 00 45 10   ...<.....`^V..E.
0010  00 34 08 d2 40 00 40 06 e7 d5 c0 a8 64 11 c0 a8   .4..@.@.....d...
0020  64 aa 00 17 10 98 c4 fa 69 57 25 66 ac 67 50 18   d.......iW%f.gP.
0030  02 da 1a c8 00 00 ff fd 18 ff fd 20 ff fd 23 ff   ........... ..#.
0040  fd 27                                             .'
0
Landman
2/24/2009 4:45:26 AM
Dear Remy Lebeau :

I've compare the raw data with the display message :

raw data :   ff  fd 18  ff  fd 20  ff  fd 23  ff  fd 27
display   :  7f 7d 18 7f 7d 20 7f 7d 23 7f 7d 27            }} }#}'

does the problem relate to this difference ? thanks.
0
Landman
2/24/2009 5:44:44 AM
<Landman Lee> wrote in message news:84659@forums.codegear.com...

>        This is the log export from Wireshark , I've flitered the telnet 
> message:

Next time, please post the actual capture file so people can open it in 
Wireshark.

<snip lots of irrelevant data>
> 0000  00 16 d3 3c fc e8 00 16 ec 60 5e 56 08 00 45 10   ...<.....`^V..E.
> 0010  00 34 08 d2 40 00 40 06 e7 d5 c0 a8 64 11 c0 a8   .4..@.@.....d...
> 0020  64 aa 00 17 10 98 c4 fa 69 57 25 66 ac 67 50 18   d.......iW%f.gP.
> 0030  02 da 1a c8 00 00 ff fd 18 ff fd 20 ff fd 23 ff   ........... ..#.
> 0040  fd 27                                             .'

The last 12 bytes are the only bytes relevant to the log you showed:

    ff fd 18 ff fd 20 ff fd 23 ff fd 27

When I run those bytes through TIdTelnet with the en8bit change I suggested 
earlier, none of those bytes ever reach the OnDataAvailable event handler, 
and thus never reach the TMemo.  As well they shouldn't, since they are all 
Telnet sequence bytes, not data bytes.  Which means you have not shown all 
of the bytes that you are having trouble with.

-- 
Remy Lebeau (TeamB)
0
Remy
2/24/2009 9:16:13 AM
Dear Remy Lebeau :

       How can I post a file in this forum ? I cannot find any link or button ...

       I just tested trace a telnet tools , found there are 18 steps between server and client during linking, corresponds to only 1 step with my program , I agree with you that the messages I received before is some control - characters , but it is strange that Idtelnet component didn't anwser the message, but identified it as some display characters . 

      Can you e-mail the demo program that can run successfully on your computer to me? and I try it on my computer , I suggest there are some environmental diferences between us.

      my address: lifeng780211@hotmail.com

      thanks.

Edited by: Landman Lee on Feb 24, 2009 2:04 AM
0
Landman
2/24/2009 10:04:45 AM
<Landman Lee> wrote in message news:84712@forums.codegear.com...

>       How can I post a file in this forum ?
>
> I cannot find any link or button ...

If you are using the Web interface, then posting a message has an "Attach 
Files" option.  Only post files to the Attachments forum, though.

If you are using the NNTP interface, then attach your file to a message and 
post it to the "embarcadero.public.attachments" newsgroup.

>       I just tested trace a telnet tools , found there are 18 steps
> between server and client during linking, corresponds to only 1
> step with my program , I agree with you that the messages I
> received before is some control - characters , but it is strange
> that Idtelnet component didn't anwser the message, but identified
> it as some display characters .

It would do that if the bytes are not being converted to String correctly, 
thus TIdTelnet.Negotiate() would not know how to parse them correctly. 
Hense my earlier suggestion to change the call to InputBufferAsString() to 
include Indy's 8-bit encoding.  That one change worked fine for me when I 
tested it using the raw data you showed from Wireshark.

However, just for good measure, I started re-writing TIdTelnet last night to 
no longer process inbound data using String anymore.  That would be the best 
solution for the long-term.

>      Can you e-mail the demo program that can run successfully
> on your computer to me?

I already told you what to change, and I already validated that it works. 
Sending you a demo program is not necessary.  Just recompile Indy with the 
change I mentioned earlier.

-- 
Remy Lebeau (TeamB)
0
Remy
2/24/2009 6:21:42 PM
Dear Remy Lebeau:

       I finally complete the program , as a database application programer , it is the first time I trace into the library source code, and the first time to  deal with TELNET protocols. It is so difficult that when I finally saw the familiar message " Red Hat Enterprise Linux AS release 4 (Nahant Update 7)" , a little tears poured out from my eyes.  ^_^"

       thanks you for your critical tips , and patient .
       thanks to the forum .
       thanks to Google Translate ...

       Apart from your suggestion, I found another place need to be modified:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      { IdTelnet.pas }

procedure TIdTelnet.SendNegotiationResp(var Resp: String);
begin
  if Connected then begin
    IOHandler.Write(Resp,en8bit);        //Need to added an "en8bit" , too
  end;
  Resp := '';    {Do not Localize}
end;  
       
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

so that we can avoid the translation errors during the message sending process . and as you said, The long term solution will be to re-write TIdTelnet to not process inbound data using String values at all.
0
Landman
2/27/2009 3:00:15 AM
<Landman Lee> wrote in message news:86076@forums.codegear.com...

>       Apart from your suggestion, I found another place need to be 
> modified:

Good catch.

> and as you said, The long term solution will be to re-write TIdTelnet to
> not process inbound data using String values at all.

That conversion is already well underway now.

-- 
Remy Lebeau (TeamB)
0
Remy
2/27/2009 6:41:20 PM
Reply:

Similar Artilces:

Converting Delphi 2007 Indy 10.2.3 to Delphi 2009 Indy 10.5.5 [Edit]
Hello, I am currently attempting to port over a Delphi 2007 project that uses Indy 10.2.3 (very successfully) to Delphi 2009 and Indy 10.5.5 (I just got the latest development build this morning). I think I am running into an encoding issue, but am not sure. Specifically, IDHTTP with SSL calls an old CGI and the CGI returns a .zip file and I then save it to the disk. In 2007 and before this worked perfectly. In 2009, it is not. Here is the examples of the 2 different results (though cut way short in the post) I am getting back: 2007: 'PK'#3#4#$14#0#0#0#8#0'rLQ9žrPb€'#0...

Problem with IdIPMCastClient Indy 10 Delphi 2009
Migrating an app from Delphi 2007 to Delphi 2009, I have run into a problem with IdIPMCastClient. Set Active to false raise exception 10049 cannot set address. Close the socket or reset socket you get either 10022 or 10038 If you disconnect and connect again by the 3rd time you will not receive any data. Having trouble updating to lastest dev snapshot. Any suggestions Regards Mike > {quote:title=Michael DuPree wrote:}{quote} > Migrating an app from Delphi 2007 to Delphi 2009, I have run into a problem with IdIPMCastClient. > Set Active to false raise exception 10049 cannot ...

Delphi 2009 and Indy 10 CharSet encoding problem
Hi guys, I'm sending some e-mails with my app, but the body text of my messages isnt displaying like expected ... example: I write some text with this characters ç ã é ó the text is changed to another char like "g". How can I fix that ? I've tryed to change the CharSet to Windows 1252 but nothing happened ... Any tips ? Regards, Diego Garcia -- Regards, Loki "Loki Man" <lokiman@hoknows.com> wrote in message news:51554@forums.codegear.com... > I've tryed to change the CharSet to Windows 1252 but noth...

Delphi 2009 / indy 10 html email unicode problem
I have updating an email application to delphi 2009 from delphi 2006. I now have the problem that html emails in in cyrrilic or greek are not send correctly. The code I used is: with IdMessage do begin clear; IsEncoded := true; Charset := 'utf-8'; ContentType :='multipart/alternative'; Encoding := meMime; UseNowForDate := true; Subject := MailSjabloon.Subject; From.Name := MailSjabloon.AfzenderNaam; From.Address ...

Indy E-Mail Problem (Indy 10, Delphi 2007)
Hello, we use Indy 10 with Delphi 2007 to get E-Mail using IMAP. We recieved an E-Mail which is not handled correctly. The E-Mail looks like this {code} Return-Path: <test@mail.com>; From: "Test Tester" <test@mail.com>; To: <test@mail.com>; Subject: Order Date: Wed, 7 Mar 2012 16:50:40 +0100 Message-ID: <15D526BEB8091D43859549D9E16E370FBA3123> MIME-Version: 1.0 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQFk6K6fcF3...

Color problems with components in Delphi 2009?
Hi list ~ just wrote a little visual component that is made up from a few multi-colored panels. At design time the colors show nicely and also when I use the component in a non-themed application. In a themed application ('Use Themes' checkbox checked) the entire components loses its colors and turns clBtnFace. Anybody have an idea what's up? TIA Kai > {quote:title=Kai Peters wrote:}{quote} > Hi list ~ > > just wrote a little visual component that is made up from a few multi-colored panels. At design time the colors show nicely and also when I use th...

Indy IdHMACSHA1 different results in Delphi 2007 and Delphi 2009
Hello newsgroup A test of the IdHMACSHA1 encryption method shows different results, and I am not sure if there is an error in my code or in the Indy code shipped with Delphi 2009. The Delphi 2007 version works in an application which communicates with Amazon Web Services and so it seems to be the correct one. Any suggestions are very welcome, maybe I just need to download a newer version of Indy? program Test; {$APPTYPE CONSOLE} uses IdHMACSHA1, IdCoderMIME, IdGlobal, SysUtils; function Base64Encode(const Input: string): string; begin Result := TIdEncode...

Installing Components Problem Delphi 2009
Hello, I´am trying to install some Thirdy Party Components in Delphi 2009 but I´am having trouble with the location. When I build the Package they go to another folder,my old delphi 2007 folder, and on the one that I choose. I aredy configureted the Path for BPL,DCUs and DCPs but this componentes don´t go follow it.I mean, I can build my old projects fine, but thoose ones no[ o.0 ]. Some information: on the "Target Core Compile:" there is a line who contains: -LE"C:\Delphi2007"(my old folder for delphi) -Le"c:\Delphi2007" -No"C:\Temp&quo...

migrating from Delphi 6 With Indy 10 to XE7 with Indy 10
I updated the original Indy in D6 to version 10 several years ago. Now I want to migrate my application from D6 to XE7 and would like some feedback on the best route to take. I usually send data using readln and writeln statements. The data is typically XML format. Since migrating to XE7 will include potential unicode data what is the best approach to take when reading and writing data? Will writeln and readln work in these cases or should I be using a different strategy to send unicode data between the tidtcpclient and tidtcpserver applications? al wrote: > I usually send data ...

Problems
Hi; We have a software developed in the Delphi 2009 and we do NOT use the runtime themes. So, the option: Projetct / Options / Application / Enable Runtime Themes is UNCHECKED. When I'm on the Delphi 2009, it's all right. The problem is when I use the Delphi 2010. The same configuration (Projetct / Options / Application / Enable Runtime Themes is UNCHECKED). The form editor (IDE) insists on show the forms with the current Windows theme. I don't like this, I want the runtime themes off while I'm programming and editing my forms. How can I solve it? Thanks to...

Indy 10 install problem / Delphi 2006
I recently did a wipe-and-reinstall on my PC. I installed Delphi 2006 and now I am trying to install the newer version of Indy10 as the one that comes with the Delphi 2006 install has bugs. I followed the instructions I found here: http://www.indyproject.org/Sockets/Docs/Indy10Installation.EN.aspx and I downloaded the new version from here: http://indy.fulgan.com/ZIP/indy10.zip I unzipped the relevant directories into a new subdirectory I created under C:\Program Files\Borland\BDS\4.0\source\Indy10New\Lib When I began step 3, which says "Now open these .dpk files and click install...

Indy 10.6 compilation with Delphi 2009
With the current Subversion branch, the Delphi 2009 compiler shows these errors: C:\Delphi\indy-10.6\Lib\System\IdStackWindows.pas(287) Error: E2137 Method 'GetSocketOption' not found in base class C:\Delphi\indy-10.6\Lib\System\IdStackWindows.pas(289) Error: E2137 Method 'SetSocketOption' not found in base class C:\Delphi\indy-10.6\Lib\System\IdStackWindows.pas(322) Fatal: F2063 Could not compile used unit 'IdIDN.pas' TIdStackWindows in System\IdStackWindows.pas, Lines 287 to 290: procedure GetSocketOption(ASocket: TIdStackSocketHandle; ALevel...

Problem with the Delphi 2009 Translation Tool [Edit]
I am new to the Delphi 2009 translation tool. In order to familiarize with the Translation Tool I found the tutorial *"ITE and ITM Tutorial for Delphi 2005* (+http://edn.embarcadero.com/article/32974+) and used the proposed step by step approach to localize the example (from english to french): success! I tried the same procedure on another simple project: success again. Given these successes, I tried to apply the same procedure to a more complex project written originally in french (FRC) coded originally with D6 and ported to D2009 w/o any problem. It is a program that uses 8 forms, t...

Delphi 4 to Delphi 2009
Hello, Thanks to all who answered my previous question. That was a great help. And atlast our client agreed to upgrade our delphi version from 4 to Delphi 2009. *Sigh*. But before that, I need to give the estimation and cost regarding the migration to delphi 2009. Can anyone tell me is there any tool to migrate from delphi 4 to delphi 2009 or just I need to compile our Delphi 4 application in Delphi 2009. I have read from the delphi 2009 feature matrix that Delphi 1 through Delphi 2007 import is possible in delphi 2009. But i am not that sure considering the size of our application. ...

Web resources about - Problem about Indy 10, IdTelnet component in Delphi 2009 - embarcadero.delphi.tools

Component - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

AirAsia disaster: Indonesia cites faulty component, crew response in crash
Pilots appear to have reset the computer system's circuit breaker, leading to a series of failures that caused them to lose control of the plane ...

Samsung announces big profits for Q3 2015, driven by components business
... So beneficial was the weakened won that it translated to quarterly gains of approximately 800 billion won ($705 million), primarily from component ...

Teardown of iPad Pro reveals revamped component layout
... Apple device teardown on the iPad Pro on Wednesday, revealing a reworked internal design dominated by massive batteries and bespoke audio components. ...

Corvette Stingray gets optional Z06 components
Filed under: Chevrolet , Coupe , Performance Chevrolet announces a series of upgrades available for the Corvette Stingray derived from the equipment ...

Crew, faulty component caused AirAsia crash
Indonesian investigators said crew action and a faulty component caused the AirAsia jet crash in the Java Sea last year, killing 162 passengers. ...

IDG Contributor Network: Four critical patches for November Patch Tuesday update core Windows and Office ...
Microsoft's November Patch Tuesday brings us four critical updates and eight important patches that attempt to resolve 54 reported vulnerabilities ...

DeBoer makes no excuses for components Sharks are missing
... 58° Navigation Home Giants A's Sharks Warriors Kings 49ers Raiders Quakes Insiders More Tickets Shop Watch DeBoer makes no excuses for components ...

Immigration Law Enforcement: A Vital Component Of National Security And Counterterrorism
While the administration claims that these refugees are being vetted, there is no way to actually screen these people

OLEDWorks finalizes acquisition of key parts of Philips OLED light source components business
OLEDWorks has announced that it has completed the acquisition of key OLED assets and relevant intellectual property from Royal Philips. Manufacturing ...

Resources last updated: 12/2/2015 7:26:58 AM