using System;
using inolik.Ftp4net;
using System.Net;
using System.IO;
namespace test{
/// <summary>
/// Zusammenfassende Beschreibung fr Class
/// </summary>
class Test
{
/// <summary>
/// Der Haupteinsprungspunkt fr die Anwendung
/// </summary>
[STAThread]
static void Main(string[] args)
{
try{
FtpClient client = new FtpClient();
// client.Open("192.168.0.5",4559);
/* client.Open("192.168.8.2",4559);
client.User("admin");
client.Pass("admin");*/
client.Open("upload.sourceforge.net");
client.User("anonymous");
client.Pass("a@test.de");
client.Noop();
String s = client.Pwd();
Console.WriteLine("..."+s);
// client.Cwd("docq");
// client.Cwd("bad-directory-name");
Console.WriteLine("...current directory is: "+client.Pwd());
client.Cdup();
/* long l = client.Idle();
client.Idle(700);
client.Idle();
client.Idle(l);
client.Idle();*/
// client.Dele("dd");
/* client.Type(FtpClientProtocol.TYPE_ASCII);
client.Type(FtpClientProtocol.TYPE_IMAGE);
client.Mode(FtpClientProtocol.MODE_STREAM);*/
// Get DNS host information.
IPHostEntry hostInfo = Dns.Resolve("192.168.8.2");
// Get the DNS IP addresses associated with the host.
IPAddress address = hostInfo.AddressList[0];
// client.Port(address,1111);
// client.Stat();
// client.Abor();
// client.Stot();
// client.Pasv();
// client.Passive = false;
client.Passive = true;
// FileStream file = File.OpenRead("Getter.java");
// new FileStream("Getter.java",FileMode.Open);
// client.PutTemporary(file);
// client.Put(file);
// client.Put(file,"tmp/a.java");
client.Cwd("incoming");
String[] ar = client.GetList();
foreach(String se in ar){
Console.WriteLine("..."+se);
}
String bin = "inolik.Ftp4net-0.1.1-bin.zip";
String src = "inolik.Ftp4net-0.1.1-src.zip";
client.Type(FtpClientProtocol.TYPE_IMAGE);
FileStream file = File.OpenRead(bin);
client.Put(file,bin);
file = File.OpenRead("../../"+src);
client.Put(file,src);
ar = client.GetList();
foreach(String se in ar){
Console.WriteLine("..."+se);
}
/* FileStream file = File.OpenWrite("index.htm");
client.Get("index.htm",file);
file.Close();
client.Type(FtpClientProtocol.TYPE_IMAGE);
file = File.OpenWrite("bilder/aa_r2_c2.gif");
client.Get("bilder/aa_r2_c2.gif",file);
file.Close();*/
/* client.Rename("index.txt","copy.txt");
ar = client.GetList();
foreach(String se in ar){
Console.WriteLine("..."+se);
}*/
client.Quit();
}
catch(Exception ex){
Console.WriteLine("..."+ex.Message);
}
Console.WriteLine("press enter");
Console.ReadLine();
}
}
}
|