0

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
LabRat
  • 1,996
  • 11
  • 56
  • 91
  • 1
    An FTP server is much like a HTTP server, in that it monitors the appropriate port waiting for a connection from a client, and then acts on the commands that the client sends to it. There are several open-source FTP servers available, combined with the RFC that covers the FTP protocol it may well be enough to get you going. You might well need to write all of it, in contrast to writing a client where you can use one of the existing libraries to do most of the actual work. – droopsnoot Sep 06 '21 at 12:02
  • okay this is a bit the way i thought i would be going i have a few ideas :) – LabRat Sep 06 '21 at 16:29

0 Answers0