hi rafaelrgl
which version of indy are you using?
Mainiacfreakus
Main Topics
Browse All TopicsHow can I send message to idtcpserver using idtcpclient.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Simplest form
Client Code
***************UNIT CODE**********************
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient;
type
TForm1 = class(TForm)
Edit1: TEdit;
IdTCPClient1: TIdTCPClient;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender
begin
try
IdTCPClient1.Connect;
if IdTCPClient1.Connected then
IdTCPClient1.WriteLn(edit1
IdTCPClient1.Disconnect;
except
end;
end;
end.
************FORM CODE*********************
object Form1: TForm1
Left = 48
Top = 176
Width = 312
Height = 143
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Edit1: TEdit
Left = 40
Top = 12
Width = 221
Height = 21
TabOrder = 0
Text = 'Message To Send'
end
object Button1: TButton
Left = 108
Top = 44
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 1
OnClick = Button1Click
end
object IdTCPClient1: TIdTCPClient
MaxLineAction = maException
Host = '127.0.0.1'
Port = 7777
Left = 40
Top = 40
end
end
Save project as client and build
SERVER CODE
****************UNIT CODE********************
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, IdBaseComponent, IdComponent, IdTCPServer;
type
TForm1 = class(TForm)
IdTCPServer1: TIdTCPServer;
Label1: TLabel;
procedure IdTCPServer1Execute(AThrea
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.IdTCPServer1Execute
begin
Label1.caption:=AThread.Co
end;
end.
*******************FORM CODE*****************
object Form1: TForm1
Left = 131
Top = 316
Width = 395
Height = 85
Caption = 'Server'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 64
Top = 8
Width = 32
Height = 13
Caption = 'Label1'
end
object IdTCPServer1: TIdTCPServer
Active = True
Bindings = <>
CommandHandlers = <>
DefaultPort = 7777
Greeting.NumericCode = 0
MaxConnectionReply.Numeric
OnExecute = IdTCPServer1Execute
ReplyExceptionCode = 0
ReplyTexts = <>
ReplyUnknownCommand.Numeri
Left = 16
Top = 4
end
end
save and build as server
then run the server
run the client and click the button
regards
Business Accounts
Answer for Membership
by: ciulyPosted on 2006-03-05 at 01:26:22ID: 16106931
here are some examples of client/server app using indy: e.com/Prog ramming/ Pr ogramming_ Languages/ Delphi/Q_2 0778629.ht ml
/c/a/Delph i-Kylix/Cr eating-Cha t- Applicat ion-with-B orland-Del phiIndy-Th e-Client/
http://www.experts-exchang
http://www.devarticles.com
cheers