vb.net how to create an FTP server (not FTP client)?

423 Views Asked by At

I'm studying how the FTP protocall works in vb.net. The client side is more than well documented and very easy to follow, however I cant find anything on building an FTP server....Maybe there is no such thing as a virtual FTP server?

I did manage to find some document online which sends files back and forth but its not an actual FTP server (rather a clever way of mimicking one).

the client side code bellow clearly states FTPWebRequests and also clearly makes a connection to an FTP server ussing a password and username... its my probable understanding a means of creating a virtual FTP server also then exists?

Imports System.IO
Imports System.Net

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        'Create Request To Download File'
        Dim wrDownload As FtpWebRequest = WebRequest.Create("ftp://ftp.test.com/file.txt")

        'Specify That You Want To Download A File'
        wrDownload.Method = WebRequestMethods.Ftp.DownloadFile

        'Specify Username & Password'
        wrDownload.Credentials = New NetworkCredential("user", "password")

        'Response Object'
        Dim rDownloadResponse As FtpWebResponse = wrDownload.GetResponse()

        'Incoming File Stream'
        Dim strFileStream As Stream = rDownloadResponse.GetResponseStream()

        'Read File Stream Data'
        Dim srFile As StreamReader = New StreamReader(strFileStream)

        Console.WriteLine(srFile.ReadToEnd())

        'Show Status Of Download'
        Console.WriteLine("Download Complete, status {0}", rDownloadResponse.StatusDescription)

        srFile.Close() 'Close

        rDownloadResponse.Close()

    End Sub
0

There are 0 best solutions below