Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Cteate your own ftp tool using TCPClient

Hi this is Satalaj.

below is my code snippet which will throw some light on how to create your own ftp tool using MS C#.Net

you can refer RFC FTP port 21.

or

http://ftpsoftware.blogspot.com/

try to execute FTP command

 protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
        string user = "";
        string pwd = "";

        System.Net.Sockets.TcpClient tcpclient = new System.Net.Sockets.TcpClient();

        tcpclient.Connect("IP_ADDRESS", INT_PORT_NO);

        NetworkStream ns = tcpclient.GetStream();

        StreamWriter writer = new StreamWriter(ns);

        StreamReader reader = new StreamReader(ns);

        writer.WriteLine("USER " + user );

        writer.Flush();

        Response.Write(reader.ReadLine()+"<BR />");

        writer.WriteLine("PASS " + pwd);

        writer.Flush();
      

        Response.Write(reader.ReadLine() +"<BR />");

        Response.Write(reader.ReadLine() + "<BR />");

      

           
        }
        catch(Exception ex)
        {
            
        }

No Comments