Gracias Dec, lo que dices es cierto. muy buena observación
;
aquí encontré una página en borland que trata sobre las diferencias entre indy 9 e indy 10:
http://bdn1.borland.com/borcon2004/a...,32160,00.html
a mí me sirvió para comprender un par de cosas... quizás a otros también.
con lo que lei aquí, hice mi primer servidor. que es muy tonto en realidad pero aún así...
Código Delphi
[-]unit server;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,IdBaseComponent, IdComponent, IdCustomTCPServer, IdTCPServer, idcontext, StdCtrls; type TForm1 = class(TForm)
server: TIdTCPServer;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure IndyConnect(AContext: TIdContext);
procedure serverExecute(AContext: TIdContext);
procedure Button1Click(Sender: TObject);
private
public
end;
var Form1: TForm1;
implementation {$R *.dfm}
procedure TForm1.IndyConnect(AContext: TIdContext);
begin
acontext.Connection.IOHandler.WriteLn('Hola!!!! estás conectado');
end;
procedure TForm1.serverExecute(AContext: TIdContext);
var text: string;
begin
with acontext.Connection.IOHandler do begin
text:= readln;
if sametext (text, 'hola')
then
begin
text:= 'hola.¿que tal?';
writeln (text);
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin server.DefaultPort:=10300;
server.active:= true; end;
end.
lo probe haciendo un telnet al puerto 10300 de 127.0.0.1, aparentemente funciona, pero no me muestra el mensaje
'hola estas conectado' . porque puede ser esto? es por el telnet?