vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
SEPA-Dateien erstellen inkl. IBAN-, BLZ-/Kontonummernprüfung  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB.NET - Fortgeschrittene
Re: Download verzeichnis bestimmen 
Autor: marina
Datum: 25.08.06 16:09

Teil 3
///
/// If the value of mode is true, set binary mode for downloads.
/// Else, set Ascii mode.
///
///
public void setBinaryMode(Boolean mode)
{

if(mode)
{
sendCommand("TYPE I");
}
else
{
sendCommand("TYPE A");
}
if (retValue != 200)
{
throw new IOException(reply.Substring(4));
}
}

///
/// Download a file to the Assembly's local directory,
/// keeping the same file name.
///
///
public void download(string remFileName)
{
download(remFileName,"",false);
}

///
/// Download a remote file to the Assembly's local directory,
/// keeping the same file name, and set the resume flag.
///
///
///
public void download(string remFileName,Boolean resume)
{
download(remFileName,"",resume);
}

///
/// Download a remote file to a local file name which can include
/// a path. The local file name will be created or overwritten,
/// but the path must exist.
///
///
///
public void download(string remFileName,string locFileName)
{
download(remFileName,locFileName,false);
}

///
/// Download a remote file to a local file name which can include
/// a path, and set the resume flag. The local file name will be
/// created or overwritten, but the path must exist.
///
///
///
///
public void download(string remFileName,string
locFileName,Boolean resume)
{
if(!logined)
{
login();
}

setBinaryMode(true);

Console.WriteLine("Downloading file "+remFileName+" from "+remoteHost + "/"+remotePath);

if (locFileName.Equals(""))
{
locFileName = remFileName;
}

if(!File.Exists(locFileName))
{
Stream st = File.Create(locFileName);
st.Close();
}

FileStream output = new
FileStream(locFileName,FileMode.Open);

Socket cSocket = createDataSocket();

long offset = 0;

if(resume)
{

offset = output.Length;

if(offset > 0 )
{
sendCommand("REST "+offset);
if(retValue != 350)
{
//throw new IOException(reply.Substring(4));
//Some servers may not support resuming.
offset = 0;
}
}

if(offset > 0)
{
if(debug)
{
Console.WriteLine("seeking to " + offset);
}
long npos = output.Seek(offset,SeekOrigin.Begin);
Console.WriteLine("new pos="+npos);
}
}

sendCommand("RETR " + remFileName);

if(!(retValue == 150 || retValue == 125))
{
throw new IOException(reply.Substring(4));
}

while(true)
{

bytes = cSocket.Receive(buffer, buffer.Length, 0);
output.Write(buffer,0,bytes);

if(bytes <= 0)
{
break;
}
}

output.Close();
if (cSocket.Connected)
{
cSocket.Close();
}

Console.WriteLine("");

readReply();

if( !(retValue == 226 || retValue == 250) )
{
throw new IOException(reply.Substring(4));
}

}
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Download verzeichnis bestimmen1.191marina25.08.06 10:13
Re: Download verzeichnis bestimmen744ModeratorFZelle25.08.06 11:45
Re: Download verzeichnis bestimmen732marina25.08.06 11:48
Re: Download verzeichnis bestimmen731uliop197825.08.06 14:16
Re: Download verzeichnis bestimmen711ModeratorFZelle25.08.06 14:24
Re: Download verzeichnis bestimmen770uliop197825.08.06 14:35
Re: Download verzeichnis bestimmen773ModeratorFZelle27.08.06 20:01
Re: Download verzeichnis bestimmen758uliop197828.08.06 10:42
Re: Download verzeichnis bestimmen856ModeratorFZelle28.08.06 20:19
Re: Download verzeichnis bestimmen771uliop197829.08.06 09:08
Re: Download verzeichnis bestimmen779marina25.08.06 16:06
Re: Download verzeichnis bestimmen753marina25.08.06 16:08
Re: Download verzeichnis bestimmen694marina25.08.06 16:10
Re: Download verzeichnis bestimmen810marina25.08.06 16:11
Re: Download verzeichnis bestimmen693marina25.08.06 16:11
Re: Download verzeichnis bestimmen742marina25.08.06 16:09
Re: Download verzeichnis bestimmen765uliop197825.08.06 16:56
Re: Download verzeichnis bestimmen739marina25.08.06 18:01

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel