Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Go Back   Foros Club Delphi > Principal > Internet
Register FAQ Members List Calendar Guía de estilo Search Today's Posts Mark Forums Read

Colaboración Paypal con ClubDelphi

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 28/04/2016
darkamerico darkamerico is offline
Miembro
 
Join Date: Dec 2010
Posts: 273
Poder: 16
darkamerico Va por buen camino
Unhappy Usando componentes RealThin para crear un WebServer y enviar archivos grandes

Saludos amigos,

La fuente de la duda se encuentra en el siguiente tutorial:
http://www.realthinclient.com/realth...rge-files-out/

Seguí todos los pasos al pie de la letra pero no se realiza el trabajo de enviar el archivo: El código de los métodos involucrados CheckRequest y DataReceived es:

Código Delphi [-]
procedure TForm1.rdpArchivosCheckRequest(Sender: TRtcConnection);
var
  nombreArchivo:string;
  rdsServer: TRTCDataServer absolute Sender;
begin
  nombreArchivo:=GetFullFileName(rdsServer.Request.FileName);
  rdsServer.Accept;
  rdsServer.Request.Info['FName']:=nombreArchivo;
  rdsServer.Response.ContentLength:=File_Size(nombreArchivo); // 1
  rdsServer.WriteHeader(); // 2
end;

Código Delphi [-]
procedure TForm1.rdpArchivosDataReceived(Sender: TRtcConnection);
var
  nombreArchivo: string;
  viSent: integer;
  rdsServer: TRTCDataServer absolute Sender;
begin
  if rdsServer.Request.Complete then
  begin
    if rdsServer.Response.ContentLength>rdsServer.Response.ContentOut then // 1
    begin
      nombreArchivo:=rdsServer.Request.Info['FName'];

      if File_Exists(nombreArchivo) then
      begin
        if File_Size(nombreArchivo)=rdsServer.Response.ContentLength then // 2
        begin
          viSent:=rdsServer.Response.ContentLength - rdsserver.Response.ContentOut; // 3

          if viSent > 16000 then viSent:=16000;  // 4

          rdsServer.Write(Read_File(nombreArchivo, rdsServer.Response.ContentOut, viSent)); //5
        end
        else
          rdsServer.Disconnect; // 6
      end
      else
        rdsServer.Write('Archivo No Encontrado!');
    end;
  end;
end;

El navegador se queda cargando eternamente y no descarga el archivo del servidor.
El único paso que no esta claro en ese tutorial es el Punto 4 titulado: Implement OnDataReceived event in OnDataSent event.

Agradezco la ayuda.


Americo
Reply With Quote
  #2  
Old 28/04/2016
Casimiro Noteví's Avatar
Casimiro Noteví Casimiro Noteví is offline
Merodeador
 
Join Date: Sep 2004
Location: En algún lugar.
Posts: 32,682
Poder: 10
Casimiro Noteví Tiene un aura espectacularCasimiro Noteví Tiene un aura espectacular
¿Has probado primero con un archivo pequeñito?
Así, al menos se sabrá si funciona o no.
Reply With Quote
  #3  
Old 29/04/2016
darkamerico darkamerico is offline
Miembro
 
Join Date: Dec 2010
Posts: 273
Poder: 16
darkamerico Va por buen camino
Hola amigo

Quote:
Originally Posted by Casimiro Notevi View Post
¿Has probado primero con un archivo pequeñito?
Así, al menos se sabrá si funciona o no.
Si hice el intento y no envía nada de nada
Reply With Quote
  #4  
Old 29/04/2016
AgustinOrtu's Avatar
[AgustinOrtu] AgustinOrtu is offline
Miembro Premium
NULL
 
Join Date: Aug 2013
Location: Argentina
Posts: 1,858
Poder: 17
AgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en bruto
En la página lo explica

Quote:
4. Implement OnDataReceived event in OnDataSent event.

Now, we must implement the OnDataReceived event for the OnDataSent event. If we don’t do this, then our server will just send the Header and the first 16K of Data and the transference will never end.
Te esta diciendo que los dos eventos comparten el mismo manejador (el mismo código)
Reply With Quote
  #5  
Old 04/05/2016
darkamerico darkamerico is offline
Miembro
 
Join Date: Dec 2010
Posts: 273
Poder: 16
darkamerico Va por buen camino
hola

efectivamente, eso hice pero al parecer olvidaron algo mas porque se queda cargando

Saludos
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Usar TServerSocket y TClientSocket para enviar "streams" más o menos "grandes" dec Internet 9 04/08/2015 16:11
Transferir archivos usando los componentes Indy cacu Varios 2 16/02/2015 09:35
Se busca: biblioteca para números grandes (muy grandes) Lord Delfos Varios 7 06/02/2010 01:26
Ayuda para enviar pdf por fax, usando Delphi 7 manolop Varios 6 15/03/2007 12:48
Enviar archivos con componentes Indy- Cliente _Servidor b3nyis Internet 1 05/04/2006 11:08


All times are GMT +2. The time now is 23:07.


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