Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Internet
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 31-10-2008
azulin azulin is offline
Miembro
 
Registrado: sep 2008
Posts: 13
Poder: 0
azulin Va por buen camino
Ya he visto donde estaba el error. Indy 10 es ligeramente distinto a 9. Aqui está el código, probado con Turbo Delphi 2006:

Código:
 
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, IdBaseComponent, IdComponent, IdTCPServer, IdHTTPServer,
  StdCtrls, StrUtils, IdCustomHTTPServer, IdContext;
 
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure IdHTTPServer1CommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
  IdHTTPServer1: TIdHTTPServer;

implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
  IdHTTPServer1 := TIdHTTPServer.Create;
  IdHTTPServer1.DefaultPort := 8080;
  IdHTTPServer1.OnCommandGet := IdHTTPServer1CommandGet;
  IdHTTPServer1.Active := True;
end;
 
procedure TForm1.IdHTTPServer1CommandGet(AContext: TIdContext;
  ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
var
  strHtml: String;
begin
  // respond
  strHtml := '<h1>Servidor DEMO</h1>' +
    '<p>This is the only page you''ll get from this example.</p><hr>' +
    '<p>Request: ' + ARequestInfo.Document + '</p>' +
    '<p>Host: ' + ARequestInfo.Host + '</p>' +
    '<p>Params: ' + ARequestInfo.UnparsedParams + '</p>' +
    '<p>The headers of the request follow: <br>' +
    ARequestInfo.RawHeaders.Text + '</p>';
  AResponseInfo.ContentText := strHtml;
end;
 

end.
Luego desde el navegador... http://127.0.0.1:8080/


Ahora tengo que ver como procesar la petición y en función de esta hacer algo.

Saludos!
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
que archivos hacen falta para controlar el office 2000 desde delphi en win98 walace_soy Varios 6 30-01-2007 19:01:57
Cómo cerrar otra aplicacion desde mi aplicacion en Delphi 7 Gaby123 API de Windows 5 04-01-2007 22:44:51
Controlar Aplicación johncook API de Windows 0 12-08-2006 22:13:53
Controlar pulsacion de una tecla desde toda la aplicacion Sick boy OOP 5 21-05-2004 17:30:48
Aplicacion Delphi desde la WEB Jessica666 Varios 0 13-05-2004 22:58:36


La franja horaria es GMT +2. Ahora son las 10:53:12.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi