dcsimg
Results 1 to 26 of 26

Thread: [RESOLVED] Get with Inet not working

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Texas
    Posts
    149

    Resolved [RESOLVED] Get with Inet not working

    Having a strange problem. The code below has been working for years, however, we just changed our hosting and now it does not perform the Get. I have verified the correct username, password and file name, including correct capitalization where used.
    Code:
            WarningLabel.Caption = "Getting existing file from WEB"
            With MyForm.Inet1
            .URL = "ftp://mysite.com"
            .UserName = "myusername"
            .Password = "mypassword"
            .Execute , "GET /mysite/mytextfilename.txt C:\testfolder\mytextfilename.txt"
             End With
    However, if I use this code, it does retrieve the file.
    Code:
             MyTest$ = MyForm.Inet1.OpenURL("www.mysite.com/mytextfilename.txt")
             Open "C:\testfolder\mytextfilename.txt" For Output As #7
             Print #7, MyTest$;
             Close #7
    The main issue is that after appending to this text file, I need to upload it back to the site. Again for years, I have been using the Put command with no issues. But it does not put either now.

    Any ideas?
    Last edited by mickeykelley; Feb 12th, 2014 at 03:15 AM.

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,619

    Re: Get with Inet not working

    Maybe your hosting provider does not support/allow FTP.

  3. #3
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,073

    Re: Get with Inet not working

    Code:
     Dim LocalPath As String
     Dim RemotePath As String
     
     LocalPath = Chr(34) & "C:\testfolder\mytextfilename.txt" & Chr(34)
     RemotePath = Chr(34) & "/mysite/mytextfilename.txt" & Chr(34) 
     
     With MyForm.Inet1
       .AccessType = icDirect
       .Protocol = icFTP
       
       .UserName = "username"
       .Password = "password"
       .RemoteHost = "www.yourwebsite.com"
         
       .Execute .URL, "GET " & RemotePath & " " & LocalPath
      
       While .StillExecuting
         DoEvents
       Wend
            
       .Execute , "CLOSE"
     End With
      '
      '
      '
    NOTE:

    You might also want to try remote path without the leading folder:

    RemotePath = Chr(34) & "/mytextfilename.txt" & Chr(34)

    OR

    RemotePath = Chr(34) & "mytextfilename.txt" & Chr(34)

    I have two websites and they differ. If I have a file in the root directory on both sites one requires the root directory name like this:

    RemotePath = Chr(34) & "/rootdirectory/mytextfilename.txt" & Chr(34)

    while the other site does not. like this this:

    RemotePath = Chr(34) & "mytextfilename.txt" & Chr(34)

    The best way to find out things about your site is to ask your host support team; that's how I know things about my sites.
    Last edited by jmsrickland; Feb 12th, 2014 at 08:53 PM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,712

    Re: Get with Inet not working

    Could be the new host has no FTP support (or it isn't enabled, etc.) or even that you are running into firewall issues. FTP is a firewall-hostile protocol.

    I doubt that the ITC ("INet" control) supports FTP's PASV mode.

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,563

    Re: Get with Inet not working

    It could also depend on what the default FTP folder is... I know that when I create users for FTP access on my sites, I can pre-determine what their default FTP folder is. Your default ftp location may not be your web root, but some other folder.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Texas
    Posts
    149

    Re: Get with Inet not working

    Still having problems. I have verified that FTP user/password is correct, FTP is turned on, is a Linux server, that the file is there, spelled correct including capitulation and in correct path, and the CHR(34) does not help. However, the web hosting support supervisor said that he can (and I verified myself) ftp in from a browser so everything is working on their end. So if I can enter in a browser ftp://mysite.com and then it asks for user name and password, so I give it the ones out of my code (cut and paste just to make sure code is using right ones), it shows me the directory and I can navigate to the file and it displays that text on the screen. I'm just not sure why not working on this new hosting site. Worked on other for 3 years with no issue.

    Is there some way to get an error or status. Because I have the folder open in a different screen so I can watch and I see it create a zero byte file temporarily, but then when the GET does not seem to get, then the file goes away.

    In the StateChanged all I get is a 3 (The control is connecting to the host computer) then empty then the next code executes but the file is never retrieved. I never get a 11 icError.
    Last edited by mickeykelley; Feb 14th, 2014 at 03:16 PM.

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,712

    Re: Get with Inet not working

    Some FTP servers only support passive (PASV) operation.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Texas
    Posts
    149

    Re: Get with Inet not working

    I was able to play with the error trapping and found that it does connect and gets some parts and goes back and forth 6 times, then gives an icError 11 and that shows code 12002 The request has timed out. I have timed it a number of times and it is exactly 30 seconds. I have the Inet.ReqauestTimeout set to 120 but it still stops as 30 seconds. Here is StateChange results:

    3 (The control is connecting to the host computer.)
    4 (The control successfully connected to the host computer.)
    7 (The control is receiving a response from the host computer.)
    8 (The control successfully received a response from the host computer.)
    5 (The control is sending a request to the host computer.)
    6 (The control successfully sent the request.)
    7 (The control is receiving a response from the host computer.)
    8 (The control successfully received a response from the host computer.)
    5 (The control is sending a request to the host computer.)
    6 (The control successfully sent the request.)
    7 (The control is receiving a response from the host computer.)
    8 (The control successfully received a response from the host computer.)
    5 (The control is sending a request to the host computer.)
    6 (The control successfully sent the request.)
    7 (The control is receiving a response from the host computer.)
    8 (The control successfully received a response from the host computer.)
    5 (The control is sending a request to the host computer.)
    6 (The control successfully sent the request.)
    7 (The control is receiving a response from the host computer.)
    8 (The control successfully received a response from the host computer.)
    5 (The control is sending a request to the host computer.)
    6 (The control successfully sent the request.)
    7 (The control is receiving a response from the host computer.)
    8 (The control successfully received a response from the host computer.)
    5 (The control is sending a request to the host computer.)
    6 (The control successfully sent the request.)
    7 (The control is receiving a response from the host computer.)
    11 (An error occurred in communicating with the host computer.)
    12002 The request has timed out (which is a Win32 HTTP Status Code)

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Texas
    Posts
    149

    Re: Get with Inet not working

    I did find out they use Apache server. Not sure if that is part of it or not.

  10. #10
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,073

    Re: Get with Inet not working

    Is it possible you can get a list of all the requests that were successful


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Texas
    Posts
    149

    Re: Get with Inet not working

    Trying to answers at GoDaddy can be challenging. May have to choose another hosting partner.

  12. #12
    Lively Member
    Join Date
    May 2009
    Location
    UK
    Posts
    68

    Re: Get with Inet not working

    it looks like your host has banned your IP for having too many connections.

    I had a similar problem - the hoster always denied that they did anything until i asked if any IPs are getting blocked. I specifically asked them to UNBLOCK / delete all IPs that block to my server.
    I am now very hesitant in using programs that I cannot control uploads to 2 connections at a time to my host.

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Texas
    Posts
    149

    Re: Get with Inet not working

    not making much progress but I do get this: 200 TYPE is now 8-bit binary. What does that mean?

  14. #14
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,073

    Re: Get with Inet not working

    The TYPE command tells the FTP server that you want to transmit data in either Binary or Ascii mode

    The syntax is

    TYPE A

    TYPE I

    at least that's what it was the last time I did any FTP transmission.

    I do not know if that is what is causing your code to not work but I also have GoDaddy hosting one of my sites and I have absolutely no problem using the code I posted in #3.

    If you have an FTP client (like CuteFTP, for example) try uploading your same file using the client and see what FTP commands are generated in the process.

    Also, if you have a packet sniffer you can get it running and then run your code again then look at the output of the sniffer to see exactly what commands were sent and received


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  15. #15
    Lively Member
    Join Date
    May 2009
    Location
    UK
    Posts
    68

    Re: Get with Inet not working

    try making these bat files and test if that works :

    Code:
    ftp -i -s:ftpdownload.bat
    ftpdownload.bat
    Code:
    open mysite.com
    myusername
    mypassword
    lcd C:\testfolder\
    cd /mysite
    binary
    mget mytextfilename.txt
    disconnect
    quit
    Code:
    ftp -i -s:ftpupload.bat
    ftpupload.bat
    Code:
    open mysite.com
    myusername
    mypassword
    lcd C:\testfolder\
    cd /mysite
    binary
    delete mytextfilename.txt
    mput mytextfilename.txt
    disconnect
    quit

  16. #16

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Texas
    Posts
    149

    Re: Get with Inet not working

    Thank you for assistance. First I found you don't use the final \ on the LCD command. I tried both the Binary and Ascii and same result. I also used both the mget and plain get and received the following:

    Code:
    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
    
    C:\Users\Mickey>cd \
    
    C:\>ftp -i -s:ftpdownload.bat
    ftp> open dilloware.com
    Connected to dilloware.com.
    220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
    220-You are user number 20 of 500 allowed.
    220-Local time is now 15:17. Server port: 21.
    220-This is a private system - No anonymous login
    220 You will be disconnected after 3 minutes of inactivity.
    User (dilloware.com:(none)):
    331 User XXXXXX OK. Password required
    
    230 OK. Current restricted directory is /
    ftp> lcd C:\Dillo
    Local directory now C:\Dillo.
    ftp> cd /Dilloware
    250 OK. Current directory is /Dilloware
    ftp> ascii
    200 TYPE is now ASCII
    ftp> get Approved.txt
    200 PORT command successful
    425 Could not open data connection to port 54907: Connection timed out
    ftp> disconnect
    221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
    221 Logout.
    ftp> quit
    
    C:\>
    Still appears to me to be a GoDaddy issue so forwarded this to them and waiting on response.
    Last edited by mickeykelley; Feb 19th, 2014 at 05:30 PM.

  17. #17
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,712

    Re: Get with Inet not working

    Code:
    425 Could not open data connection to port 54907: Connection timed out
    That almost certainly tells you that a firewall at your end is blocking the data channel. Somebody probably unblocked all inbound connections from your old host in the past (yikes!).

    This is why you need PASV mode.

    It is not a "GoDaddy issue" but all on your end.

  18. #18
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,712

    Re: Get with Inet not working

    Good news.

    It appears that unlike many other shabby free and cheap LAMP-hosted sites, GoDaddy supports WebDAV.

    You could rely on Windows redirectors for this (see Using Web Folders (WebDAV) to Connect to Online Storage).

    Or better yet, your programs could just use a lightweight WebDAV library or equivalent VB6 code. One example of this is my ThinDavApi.cls which only uses MSXML 3.0 as a dependency (part of Windows for a very long time, included as far back as Windows 95 once IE 5.5 or later has been installed).

    See VB6 - ThinDavApi, Cloud Storage for the Masses

    This will let you do away with creaky, old, obsolete, problematic FTP once and for all.

  19. #19
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,712

    Re: Get with Inet not working

    Here's a stripped down sample program that just lets you download, edit, and upload simple text. It assumes you will "open a folder" on your WebDAV-enabled server and then upload/download text files there.
    Attached Files Attached Files

  20. #20
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,712

    Re: Get with Inet not working

    Well that might be a bust as well.

    Even though GoDaddy does support WebDAV for its "online storage" service, their Web hosting is another story.

    I am looking for anyone who has successfully used the webDAV with Godaddy hosting. I have the WebDAV files on godaddy and when i enter the URL in the webDAV settings it says my site is ready for uploading, however when i use the webDAV to upload my site i get the error:

    Unable to connect to server
    Check connection settings
    error: unable to write test file on server

    Godaddy insists that webDAV is not compatible with shared hosting and they cannot help me any further. Needless to say this has pushed me way behind schedule and my Medialab ticket has been open for days. I desperately need some help. I am on a Linux server with PHP 5 enabled.
    The usual culprit is PHP, which breaks a lot of rules and so isn't compatible with the WebDAV module for Apache. Shabby, cheapo LAMP strikes again:

    Wish More Hosts Offered WebDAV? Blame PHP!

  21. #21

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Texas
    Posts
    149

    Re: Get with Inet not working

    Quote Originally Posted by dilettante View Post
    Code:
    425 Could not open data connection to port 54907: Connection timed out
    That almost certainly tells you that a firewall at your end is blocking the data channel. Somebody probably unblocked all inbound connections from your old host in the past (yikes!).

    This is why you need PASV mode.

    It is not a "GoDaddy issue" but all on your end.
    So how would it be that I have hundreds of customers using our program which includes this ftp function and they are obviously not under my firewall and the likelyhood that all of them had someone let the other server thru....pretty slim. The only thing that changed was the host.

  22. #22
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,712

    Re: Get with Inet not working

    Well then if everyone is experiencing this problem and they were not required to set up firewall rules to permit the activity with the old host... then I suppose it is possible that a firewall at the host itself is blocking active-mode FTP data channel connections.

    You've already demonstrated that FTP through a browser works, right? My guess is that the browser is configured to handle passive mode.

    Have you tested this manually using the Windows command line FTP client (FTP.exe)? Here is one short description of the process. You need to use quot pasv once you have established a session.


    Ultimately you should move to WebDAV hosting. FTP has never been a good protocol for programmatic use, and exponentially poorer when you need clients (your programs) to work when widely distributed among other networks.

  23. #23

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Texas
    Posts
    149

    Re: Get with Inet not working

    So here is the final follow-up and answer, or not. No luck with the GoDaddy so I tried another hosting who also had a Linux running Apache and no luck there either. It would start, connect to server, accept password, start Send/Receive response, then just time out. So I went back to original hosting and guess what, it worked. They said theirs was a Hybrid Linux running Apache but I have no idea if that is the issue or not. But while it was working back on original, I kept playing with the GoDaddy using another one of our domains and made no progress, UNTIL at one point I was talking to a tech and he said we needed to be on their new CPanel server. So we did a test and it worked like a charm. So I am moving it all back but to their new CPanel server. I never could get a clear answer what the difference between the 'old' server and this 'new' but it solved the problem. He said that on BOTH servers, they do either Active or Passive. So I'm not sure what is different on this 'new' server but it works. He did say something about this new CPanel server is very open for flexibility, whatever that means. If I get any better answers, I'll post them back her for any future reference.

  24. #24
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,073

    Re: Get with Inet not working

    Quote Originally Posted by mickeykelley View Post
    So here is the final follow-up and answer, or not. No luck with the GoDaddy so I tried another hosting who also had a Linux running Apache and no luck there either. It would start, connect to server, accept password, start Send/Receive response, then just time out. So I went back to original hosting and guess what, it worked. They said theirs was a Hybrid Linux running Apache but I have no idea if that is the issue or not. But while it was working back on original, I kept playing with the GoDaddy using another one of our domains and made no progress, UNTIL at one point I was talking to a tech and he said we needed to be on their new CPanel server. So we did a test and it worked like a charm. So I am moving it all back but to their new CPanel server. I never could get a clear answer what the difference between the 'old' server and this 'new' but it solved the problem. He said that on BOTH servers, they do either Active or Passive. So I'm not sure what is different on this 'new' server but it works. He did say something about this new CPanel server is very open for flexibility, whatever that means. If I get any better answers, I'll post them back her for any future reference.
    I'm on Go-Daddy and have been there for many years and I am not on their new CPanel and I have absolutely no problems sending FTP commands to their server.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  25. #25

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Texas
    Posts
    149

    Re: [RESOLVED] Get with Inet not working

    I'm not sure. To be real honest, I believe it has been a setting on the GoDaddy side all along that has not been set correctly. I tried to get to a system administrator a number of times to verify this, but they are too big to be able to do that. For me it is working now and the hosting fee basically only changed from 4.50/mo to 6/mo so I'm moving forward. Thanks to all for feedback.

  26. #26

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Texas
    Posts
    149

    Re: [RESOLVED] Get with Inet not working

    Today I stumbled into what I'm pretty sure caused the issue from the beginning. I was messing with it again doing final testing before I released it to customers and decided to set the properties for Inet thru the control properties instead of programatically like I had been. Just before I did this change, it had been working perfectly with multiple tests. Then after the change it started doing what it had with the problem back in February. After undoing everything I had done that day, it still was messing up which made no sense at all. I had removed the .url .UserName and .Password properties from the control and un-remarked the program lines where they were originally set, recompiled but still not working. Then I decided to delete the control from the app and then add it back, did a compile and it worked. So just to be sure, I remarked out the code lines, copy and pasted into those 3 properties direct on the control, complied and broke again. Deleted the control, took the remarks off those 3 code lines, recompiled and working again. Then I remembered when I originally was adding the new GoDaddy user/password, etc. I had decided to do it under properties instead of having to change it everywhere in the code. That's what broke it originally. Also, it will not work in the environment, but has to be compiled and tested as complied code. Thus I'm not real sure being under their newer cPanel server was really necessary, but it's all working now.

    This is just a followup just in case it helps anyone in the future.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width