Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Internet
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Colaboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #3  
Antiguo 22-10-2010
petete2008 petete2008 is offline
Miembro
 
Registrado: oct 2008
Posts: 109
Poder: 18
petete2008 Va por buen camino
Código:
function DownloadToStream(Url: string; Stream: TStream): Boolean;
var
  hNet: HINTERNET;
  hUrl: HINTERNET;
  Buffer: PChar;
  BytesRead: DWORD;
  i: Integer;
begin
  Result := FALSE;
  hNet := InternetOpen('agent', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
  if (hNet <> nil) then
  begin
    hUrl := InternetOpenUrl(hNet, PChar(Url), nil, 0,
      INTERNET_FLAG_RELOAD, 0);
    if (hUrl <> nil) then
    begin
      GetMem(Buffer,100*1024);
      try
        while (InternetReadFile(hUrl, Buffer, 100*1024, BytesRead)) do
        begin
          if (BytesRead = 0) then
          begin
            Result := TRUE;
            break;
          end;
          // Aqui sustituimos el caracter nulo por un espacio
          for i:= 0 to BytesRead - 1 do
            if Buffer[i] = #0 then
              Buffer[i]:= #32;
          Stream.WriteBuffer(Buffer^,BytesRead);
        end;
      finally
        FreeMem(Buffer);
      end;
      InternetCloseHandle(hUrl);
    end;
    InternetCloseHandle(hNet);
  end;
end;

    try
      DownloadToStream(url,Stream);
      Memo1.Lines.Text:= Stream.DataString;
    finally
      Stream.Free;
 
    end;
Quiero que si la web no responde, en 30 segundos se detenga y se quede a la espera durante 30 minutos hasta que vuelva a intentarlo de nuevo.
Gracias
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

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
falla conexion mysql jaimeh MySQL 3 06-05-2010 13:34:24
conexion de internet falla en la red m8estrella83 Redes 3 11-02-2010 20:47:37
Cuando falla la conexión JLR Conexión con bases de datos 8 31-10-2007 12:56:32
Conexion a firebird Falla Paoti Conexión con bases de datos 7 11-05-2004 21:35:33


La franja horaria es GMT +2. Ahora son las 18:27:12.


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