Question Trouble connectiong to FTP server

Jan Grenov

Member
Joined
Jun 30, 2012
Messages
6
Programming Experience
3-5
Hi

I am developing an add-in for Autodesk Revit and I need to create a download module where users can download Revit Family files from an ftp server.
This is new land to me, so I need to learn more about handling this.

I tried to connect this way
Dim ftpRequest As FtpWebRequest = WebRequest.Create("ftp://ipnumber/Plug-in/" & "test.txt")
ftpRequest.Method = Net.WebRequestMethods.Ftp.DownloadFile
ftpRequest.Credentials = New Net.NetworkCredential("myusername", "mypassword") Dim response As FtpWebResponse = DirectCast(ftpRequest.GetResponse(), FtpWebResponse)
Dim responseStream As Stream = response.GetResponseStream()
Dim reader As New StreamReader(responseStream)

That worked on my test server, but it does not Work on the real server. I get a timeout error!

I have access to this information:
FTP server IP-address
Port number
User ID
Password

Now my question: Any hints on what may be the cause and where to find tutorials?

Regards
Jan Grenov
 
Last edited:
Now my question: what's different between the test server and the real server?

If it's just a simple file download then you'd be better off using a WebClient, which provides a simpler API. That said, to determine whether you're getting any data at all, have you tried just reading a few Bytes from the response Stream?
 
Thanks for replying

Well testserver versus real server ... Trouble is my ability to explain thogougly in plain English. Sorry.

Test server is a web server that I know to Work like "ftp://IPaddress/domain.dk/TestFolder/"
Real server is the web server that i actually should connect to like "ftp://SomeOtherIPaddress/domain.dk/TestFolder/"
...simple as that.

Though I have made add-ins for Autodesk products for a long time I am quite new to the discipline of connecting to ftp, so I guess that need more basic knowledge concerning this. I'll try to search WebClient solutions.
Any hints on where to start looking?

Jan
 
I'll try to search WebClient solutions.
Any hints on where to start looking?

The MSDN documentation. Assuming that you don't need any more fine-grained control, it's as simple as creating an instance and calling DownloadFile or DownloadString.
 

Latest posts

Back
Top