Member Login

Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

help with Indy TCP components

help with Indy TCP components


I'm trying to follow the example here:

but right at the outset I'm falling over with the onexecute procedure.

Firstly, if I double click the event to create the procedure, as I normally do I get this:


procedure TSDIAppForm.IdTCPServer1Execute(AContext: TIdContext);

instead of as the example says:


procedure TSDIAppForm.IdTCPServer1Execute(AThread: TIdPeerThread);

both of which (I if manually create the second) are showing an undeclared identifier on both TIdContext and TIdPeerThread.

I note the date on the demo is fairly old, have the Indy components changed, or is there a problem with my install, missing components?
If the tutorial is outdated for my Delphi 2007 Indy palette, does anyone know some recent ones?

Here is my entire code:




uses Windows, Classes, Graphics, Forms, Controls,
  StdCtrls, Buttons, ExtCtrls, ComCtrls, StdActns,
  ActnList, ToolWin, IdBaseComponent, IdComponent, IdCustomTCPServer,

  TSDIAppForm = class(TForm)
    StatusBar: TStatusBar;
    IdTCPServer1: TIdTCPServer;
    procedure IdTCPServer1Execute(AContext: TIdContext);
    { Private declarations }
    { Public declarations }

  SDIAppForm: TSDIAppForm;


uses about;

{$R *.dfm}

procedure TSDIAppForm.IdTCPServer1Execute(AContext: TIdContext);
// TidContext is 'undeclared identifier' ?


Steve (Delphi 2007 & XP)

RE: help with Indy TCP components


OK, I found another example direct from Indy, and could see I need this added to the uses of my prog:



Steve (Delphi 2007 & XP)

RE: help with Indy TCP components

TIdPeerThread = Indy 9, TIdContext = Indy 10. the demos are old and were never updated to Indy10. changing TIdPeerThread to TIdContext will solve most problems.


 What You See Is What You Get
Never underestimate tha powah of tha google!

RE: help with Indy TCP components


Thanks Daddy, that's valuable info!

I am still getting an error at compile time though now.

Here is my OnExecute:


procedure TSDIAppForm.IdTCPServer1Execute(AContext: TIdContext);
s: string;
i: integer;
  with AContext.Connection.IOHandler do
      WriteLn('Type an integer and ENTER');
      s := ReadLn;
        i := StrToInt(s);
        WriteLn(s + ' squared is ' + IntToStr(i*i));
        WriteLn(s + ' is not an integer.');

but I am getting the error:


Steve (Delphi 2007 & XP)

RE: help with Indy TCP components

show the whole demo (and also the dfm)


 What You See Is What You Get
Never underestimate tha powah of tha google!

RE: help with Indy TCP components


The start of a new day here sorted things out.
After spending last night comparing the working demo to my test prog line by line, to see some cunning difference between the two and failing, including examining all files in the project folders, today I spotted it very quickly.

For some reason, despite my double clicking next to the event in the IDE to create the procedure, the OnExecute event name was blank when I checked it. Pasting the procedure name in fixed it.

This is odd, and has never happened to me before!

Steve (Delphi 2007 & XP)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close