Ver Mensaje Individual
  #2  
Antiguo 14-11-2007
fide fide is offline
Miembro
 
Registrado: oct 2006
Posts: 331
Reputación: 20
fide Va por buen camino
Lightbulb Usar los Sockets de la Indy!

Oyeme, por que al conectarte no le envias al servidor todas las informaciones que el necesite mediante la intruccion WriteLn??

Asi le enviarias todos los datos ya directamente!

Ejemplo:

Insertas un idTCPClient y un idTCPServer.

Esto lo pones en el OnClick de un Boton u otro evento...

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
 vIp, vName, vCommand: String;
begin

  vIp := '127.0.0.1';
  vName := 'localhost';
  vCommand := 'logoff';

  with IdTCPClient1 do
   begin
    Host := '127.0.0.1';
    Port := 7099;
    Connect;
   end;

   if IdTCPClient1.Connected then
    begin
      IdTCPClient1.WriteLn(vIp);
      IdTCPClient1.WriteLn(vName);
      IdTCPClient1.WriteLn(vCommand);
      IdTCPClient1.Disconnect; 
    end;

end;

Esto lo pones en el OnExecute del idTCPServer

Código Delphi [-]
procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
var
 vIp, vName, vCommand: String;
begin

  vIp := AThread.Connection.ReadLn;
  vName := AThread.Connection.ReadLn;
  vCommand := AThread.Connection.ReadLn;

  AThread.Connection.Disconnet;

  ShowMessage(vIp + #10 + vName + #10 + vCommand);

end;

Esto es solo una idea. Pero puedes continuar preguntando si necesitas algo okas...
Responder Con Cita