![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Buscar | Temas de Hoy | Marcar Foros Como Leídos |
![]() |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
|
|
#1
|
|||
|
|||
|
Hola de nuevo,
estoy usando el siguiente código que me sugirió Omega, pero hay algunas unidades que no las encuentra: IdThreadMgr, IdThreadMgrDefault Estoy usando Turbo Delphi 2006 e Indy 10. No se donde puede estar el problema... Código:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPServer, IdHTTPServer,
StdCtrls, StrUtils, IdThreadMgr, IdThreadMgrDefault;
type
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure IdHTTPServer1CommandGet(AThread: TIdPeerThread; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
private
{ Private declarations }
public
{ Public declarations }
IdHTTPServer1: TIdHTTPServer;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
IdHTTPServer1.Active := True;
end;
procedure TForm1.IdHTTPServer1CommandGet(AThread: TIdPeerThread;
RequestInfo: TIdHTTPRequestInfo; ResponseInfo: TIdHTTPResponseInfo);
begin
if ARequestInfo.Document = '/iniciar' then begin
ShowMessage('Iniciar');
end else begin
ShowMessage('Finalizar');
end;
AResponseInfo.CloseConnection := True;
end;
end.
dasda |
|
#2
|
|||
|
|||
|
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.
Ahora tengo que ver como procesar la petición y en función de esta hacer algo. Saludos! |
![]() |
| Herramientas | Buscar en Tema |
| Desplegado | |
|
|
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 |
|