*哪位高手有IdTCPClient和IdTCPServer相互传递消息的例子
****谁有IdTCPClient和IdTCPServer相互传递消息的例子?
我需要一个简单的例子:
IdTCPClient ==> 传消息到==> IdTCPServer
IdTCPServer ==> 传消息到==> IdTCPClient
------解决方案--------------------
//简单些一个,具体实现的时候就不能这么简单了。。。
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
self.IdTCPServer1.DefaultPort:=88888;
self.IdTCPServer1.Active:=true;
self.IdTCPClient1.Host:= '127.0.0.1 ';
self.IdTCPClient1.Port:=88888;
try
self.IdTCPClient1.Connect( 5000 );
self.IdTCPClient1.Write( 'aaaaa ' );
showmessage( self.IdTCPClient1.ReadLn() );
self.IdTCPClient1.Disconnect;
except
end;
end;
procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
begin
with AThread.Connection do
begin
if ReadLn = 'aaaaa ' then
begin
Write( 'hello world ' );
end;
end;
end;
------解决方案--------------------
http://www.2ccc.com/article.asp?articleid=3894
------解决方案--------------------
\Program Files\Borland\Delphi\Demos\Indy\BasicClientServer\
\Program Files\Borland\Delphi6\Demos\Internet\Chat\
------解决方案--------------------
//简单些一个,具体实现的时候就不能这么简单了。。。
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
self.IdTCPServer1.DefaultPort:=88888;
self.IdTCPServer1.Active:=true;
self.IdTCPClient1.Host:= '127.0.0.1 ';
self.IdTCPClient1.Port:=88888;
try
self.IdTCPClient1.Connect( 5000 );
self.IdTCPClient1.Write( 'aaaaa ' );
showmessage( self.IdTCPClient1.ReadLn() );
self.IdTCPClient1.Disconnect;
except
end;
end;
procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
begin
with AThread.Connection do
begin
if ReadLn = 'aaaaa ' then
begin
Write( 'hello world ' );
end;
end;
end;
我需要一个简单的例子:
IdTCPClient ==> 传消息到==> IdTCPServer
IdTCPServer ==> 传消息到==> IdTCPClient
------解决方案--------------------
//简单些一个,具体实现的时候就不能这么简单了。。。
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
self.IdTCPServer1.DefaultPort:=88888;
self.IdTCPServer1.Active:=true;
self.IdTCPClient1.Host:= '127.0.0.1 ';
self.IdTCPClient1.Port:=88888;
try
self.IdTCPClient1.Connect( 5000 );
self.IdTCPClient1.Write( 'aaaaa ' );
showmessage( self.IdTCPClient1.ReadLn() );
self.IdTCPClient1.Disconnect;
except
end;
end;
procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
begin
with AThread.Connection do
begin
if ReadLn = 'aaaaa ' then
begin
Write( 'hello world ' );
end;
end;
end;
------解决方案--------------------
http://www.2ccc.com/article.asp?articleid=3894
------解决方案--------------------
\Program Files\Borland\Delphi\Demos\Indy\BasicClientServer\
\Program Files\Borland\Delphi6\Demos\Internet\Chat\
------解决方案--------------------
//简单些一个,具体实现的时候就不能这么简单了。。。
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
self.IdTCPServer1.DefaultPort:=88888;
self.IdTCPServer1.Active:=true;
self.IdTCPClient1.Host:= '127.0.0.1 ';
self.IdTCPClient1.Port:=88888;
try
self.IdTCPClient1.Connect( 5000 );
self.IdTCPClient1.Write( 'aaaaa ' );
showmessage( self.IdTCPClient1.ReadLn() );
self.IdTCPClient1.Disconnect;
except
end;
end;
procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
begin
with AThread.Connection do
begin
if ReadLn = 'aaaaa ' then
begin
Write( 'hello world ' );
end;
end;
end;