ftp connection to a remote server

jimbo_azim

New member
Joined
Jul 31, 2006
Messages
1
Programming Experience
Beginner
can anybody help me please.i need to connect to a remote server that is using an ip address.it has a username and password and a port number. I need to copy a specific file to my computer (already know the directory),please.. quite urgent.i'm not that good in coding as well...hehhhehe...anyway thanks in advance
 
Last edited:
do you know the P/W & U/N?

Do you know the Password and Username required for access to the server?
If not, and you are not much of a coder I would suggest giving up, otherwise...
You will need to import the following namespaces.
Imports System.IO
Imports System.net
Imports System.net.sockets

Look into these and comeback with some refined questions (I imagine you would need to if you are not yet a master coder, nor am I for that matter).
I will also look into this as I am thinking about writing my own FTP app or something of the likes. (I would be happy to help, but like I said Im no guru)

Good Luck:)
 
Here is one simple example using the System.Net.WebClient class:
VB.NET:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles Button1.Click
        Dim wc As New Net.WebClient
        wc.Credentials = New Net.NetworkCredential("username", "password")
        Dim filename As String = "example.gif"
        Dim savepath As String = IO.Path.Combine(Application.StartupPath, filename)
        Try
            wc.DownloadFile("[URL]ftp://someftpserver.net/pics/[/URL]" & filename, savepath)
            Process.Start(savepath)
        Catch wex As Net.WebException
            MessageBox.Show(wex.Message)
        End Try
    End Sub
 
Back
Top