Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems using Internet Transfer Control for FTP

Status
Not open for further replies.

dbrooks

Programmer
Jun 19, 2000
4
US
I am trying to connect to a FTP site to download files from a remote site.&nbsp;&nbsp;I have the correct settings to connect but when it tries to connect for a while it times-out.&nbsp;&nbsp;I experimented typing the URL in IE 5.0 and I get the same result.&nbsp;&nbsp;However I can connect fine using FTP explorer.&nbsp;&nbsp;I am really trying to avoid programming winsock function because I believe Inet will be easier to maintain.&nbsp;&nbsp;Here's what my code looks like.&nbsp;&nbsp;I would appreciate any type of input.<br><br>Private Sub cmdFTP_Click()<br>&nbsp;&nbsp;&nbsp;&nbsp;Inet1.AccessType = icDirect<br>&nbsp;&nbsp;&nbsp;&nbsp;Inet1.Protocol = icFTP<br>&nbsp;&nbsp;&nbsp;&nbsp;Inet1.RemotePort = &quot;21&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;Inet1.RemoteHost = &quot;208.18.119.91&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;Inet1.UserName = &quot;xxxxxxxxxxx&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;Inet1.Password = &quot;xxxxxxxx&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;picStatus.Print &quot;Connecting...&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;Inet1.OpenURL (&quot;<A HREF="ftp://USERNAME:pASSWORD@208.18.119.91/&quot" TARGET="_new">ftp://USERNAME:pASSWORD@208.18.119.91/&quot</A>;)<br>&nbsp;&nbsp;&nbsp;&nbsp;If Inet1.OpenURL = False Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;picStatus.Print &quot;Error: Unable to Connect to Host&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;picStatus.Print &quot;Connected to 208.18.119.91&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Call Dir<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Call Transfer<br>&nbsp;&nbsp;&nbsp;&nbsp;End If<br>End Sub
 
try this after your Inet1.OpenURL line<br><FONT FACE=monospace><b><br>While (Inet1.StillExecuting)<br>&nbsp;&nbsp;&nbsp;&nbsp;DoEvents<br>Wend<br></font></b><br>The line:<br><FONT FACE=monospace><b><br>If Inet1.OpenURL = False Then<br></font></b><br>Didn't know you could do that after calling OpenURL beforehand -- is it right?<br><br>The example in VB6 help looks like this:<br><FONT FACE=monospace><b><br>&nbsp;&nbsp;&nbsp;Inet1.AccessType = icUseDefault<br>&nbsp;&nbsp;&nbsp;Dim b() As Byte<br>&nbsp;&nbsp;&nbsp;Dim strURL As String<br><br>&nbsp;&nbsp;&nbsp;' Presuming this is still a valid URL.<br>&nbsp;&nbsp;&nbsp;strURL = &quot;<A HREF="ftp://ftp.microsoft.com/&quot" TARGET="_new">ftp://ftp.microsoft.com/&quot</A>; & _<br>&nbsp;&nbsp;&nbsp;&quot;developr/drg/Win32/Autorun.zip&quot;<br><br>&nbsp;&nbsp;&nbsp;' Retrieve the file as a byte array.<br>&nbsp;&nbsp;&nbsp;b() = Inet1.OpenURL(strURL, icByteArray)<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;Open &quot;C:\Temp\Autorun.zip&quot; For Binary Access _<br>&nbsp;&nbsp;&nbsp;Write As #1<br>&nbsp;&nbsp;&nbsp;Put #1, , b()<br>&nbsp;&nbsp;&nbsp;Close #1<br></font></b> <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Mike,<br><br>Thanks for responding to my need.&nbsp;&nbsp;I'll be sure to try out that code.&nbsp;&nbsp;To answer your question about the OpenURL, I have had incidences where if I couldn't log onto the site because of syntax errors or something that it would print to my pseudo-status window &quot;Error: Unable to Connect to Host.&quot;&nbsp;&nbsp;However, I this code may not be right.<br><br>Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top