Alpha Video Training
Results 1 to 12 of 12

Thread: ftp_put_file error when ftp server down

  1. #1
    Member APFCClyde's Avatar
    Real Name
    Clyde Tilley
    Join Date
    Dec 2005
    Location
    Phoenix AZ
    Posts
    125

    Default ftp_put_file error when ftp server down

    I've written a program to parse data & transfer to an ftp server. The program runs automatically from task scheduler & works perfectly until... the ftp server goes down. Then Alpha displays a box that says "could not login to server" and stops there. I've tried "on error" but it won't trap that error. I've tried hostavailable but it always returns true even when the ftp server is down.

    Anyone know how to trap this error or test to see if the ftp server is working? Needless to say I'm at a complete standstill until I can solve this last issue.

    Thx

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: ftp_put_file error when ftp server down

    Are you using the full construction

    Result as C = FTP_PUT_FILE( ....

    You should be able to test the result variable and branch from there.
    Last edited by Stan Mathews; 02-09-2009 at 01:17 PM.

  3. #3
    Alpha Software Employee Lenny Forziati's Avatar
    Real Name
    Lenny Forziati
    Join Date
    Nov 2001
    Location
    Alpha Software
    Posts
    4,695

    Default Re: ftp_put_file error when ftp server down

    Are you supplying the optional port number argument to hostavailable()? If not, it is testing to see if there is a server running on port 80. By specifying 21 (or whichever port your FTP server uses), you can specifically test to see if FTP is running.

    Lenny Forziati
    Vice President, Internet Products and Technical Services
    Alpha Software Corporation

  4. #4
    Member APFCClyde's Avatar
    Real Name
    Clyde Tilley
    Join Date
    Dec 2005
    Location
    Phoenix AZ
    Posts
    125

    Default Re: ftp_put_file error when ftp server down

    Quote Originally Posted by Stan Mathews View Post
    Are you using the full construction

    Result as C = FTP_PUT_FILE( ....

    You should be able to test the result variable and branch from there.
    Unfortunately, the problem is the error box pops up & stops the script, so I can't get to test a result code.

    Lenny, yes I tried port 21 - it still returns true no matter if the server is up or not:

    c=hostavailable("192.168.0.40", 21)
    ? c
    = "T"

    The server is down but it still returns true - would be great if it worked.

  5. #5
    Alpha Software Employee Lenny Forziati's Avatar
    Real Name
    Lenny Forziati
    Join Date
    Nov 2001
    Location
    Alpha Software
    Posts
    4,695

    Default Re: ftp_put_file error when ftp server down

    Clyde, the default return value for hostavailable is false, so in order for it to tell you true, something on 192.168.0.40 is accepting a connection on port 21. Is something else using that port? How are you determining that the server is down?

    Lenny Forziati
    Vice President, Internet Products and Technical Services
    Alpha Software Corporation

  6. #6
    "Certified" Alphaholic
    Real Name
    Bill Griffin
    Join Date
    Jul 2001
    Location
    Edgewood, NY
    Posts
    1,201

    Default Re: ftp_put_file error when ftp server down

    Lenny,

    Correct me if I am wrong, but hostavailable will only tell you that there is a connection to the host and the optional port you give it is open, not that an ftp or http server is running?

    Bill

  7. #7
    Alpha Software Employee Lenny Forziati's Avatar
    Real Name
    Lenny Forziati
    Join Date
    Nov 2001
    Location
    Alpha Software
    Posts
    4,695

    Default Re: ftp_put_file error when ftp server down

    hostavailable() connects to a host on the specified port. In order to succeed, something on the host must accept the remote connection.

    Typically the accept is done by a server process itself (the FTP server), but some systems have a daemon process which listens on specified ports and spawns the server on-demand. With this type of configuration, there is a possibility that the server process could be not running yet the connection would be accepted.

    Lenny Forziati
    Vice President, Internet Products and Technical Services
    Alpha Software Corporation

  8. #8
    Member APFCClyde's Avatar
    Real Name
    Clyde Tilley
    Join Date
    Dec 2005
    Location
    Phoenix AZ
    Posts
    125

    Default Re: ftp_put_file error when ftp server down

    Quote Originally Posted by Lenny Forziati View Post
    Clyde, the default return value for hostavailable is false, so in order for it to tell you true, something on 192.168.0.40 is accepting a connection on port 21. Is something else using that port? How are you determining that the server is down?
    I take the server down manually & it is the only thing using port 21. If I use PortQry.exe to test it after I take it down, it shows NOT LISTENING. I set PortQry to run in a loop until it detects the port available and it shows NOT LISTENING until I restart the ftp server. Then it shows LISTENING & exits the loop. Maybe like Bill said, Alpha's detecting an open port (as in it's not blocked by the os) as opposed to actually detecting a connection to the server itself.

    If ftp_put_file would allow trapping the Could not login to server error, then this would be a non-issue as it could be used to loop the script until a connection could be established. But instead it pops up a msgbox effectively halting the script leaving it in limbo. Since it doesn't allow trapping I guess I'll have to find a work around.

    Thx
    Last edited by APFCClyde; 02-09-2009 at 05:30 PM.

  9. #9
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: ftp_put_file error when ftp server down

    Clyde,
    Have you tried a different port?....have you tried a different computer? c=hostavailable("spock.serveftp.com", 21) works fine here for my FTP server--.F. when off and .T. when on.

    In fact it shows your server as being .F. currently......
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




  10. #10
    Member APFCClyde's Avatar
    Real Name
    Clyde Tilley
    Join Date
    Dec 2005
    Location
    Phoenix AZ
    Posts
    125

    Default Re: ftp_put_file error when ftp server down

    I've found the problem - just have to figure out why.

    I did a quick check by running hostavailable on my system
    & it worked. All three systems are on the same local network.
    Both versions of Alpha are the same. So, just for grins &
    giggles, I turned off the firewall on the production system
    & viola! it worked! So the firewall on that system
    (Win XP Pro SP3) is fouling up the hostavailable command.
    Alpha5 is set in exceptions.

    Alpha is able to send via ftp fine as long as the ftp
    server is up.

    Anyone have ideas why that would be?
    Last edited by APFCClyde; 02-10-2009 at 11:33 AM.

  11. #11
    Member APFCClyde's Avatar
    Real Name
    Clyde Tilley
    Join Date
    Dec 2005
    Location
    Phoenix AZ
    Posts
    125

    Default Re: ftp_put_file error when ftp server down

    Since I'm still researching the firewall problem, I had to get this working, so I've found a quick workaround and am posting it here in case it might be useful to anyone:

    Microsoft has a command line utility called portqry.exe available here:

    http://www.microsoft.com/downloadS/d...displaylang=en

    I put this in a bat file like so:

    :Top
    @echo off
    c:\portqryv2\portqry -n 192.168.0.40 -e 21

    @if errorlevel != 0 goto Top

    exit

    which runs using sys_shell_wait to test the ftp server. As you can see it loops continuously until the server is available at which time it would exit and continue the Alpha processing. As the machine on which the ftp server resides is a production machine, I would know right away & would be resetting it should it be down, so the bat file wouldn't run long before the ftp server was back up.

  12. #12
    "Certified" Alphaholic Charles Hoens's Avatar
    Real Name
    Charles Hoens
    Join Date
    Sep 2000
    Location
    Princeton, NJ
    Posts
    1,170

    Default Re: ftp_put_file error when ftp server down

    Clyde,

    Thanks for addressing this issue and being so persistent. I too, was having this error and was beginning to believe it was all in my head. The FTP commands need to be rewritten, hopefully soon. But in the meantime this has solved my multiple box pop-up problems!

    Thanks again!

    Charlie

Similar Threads

  1. Best way to transfer file from the server to another server - ftp? how?
    By drgarytraub in forum Application Server Version 9 - Web/Browser Applications
    Replies: 18
    Last Post: 12-22-2008, 03:49 PM
  2. FTP from Server
    By vinyltap in forum Application Server Version 8
    Replies: 3
    Last Post: 07-23-2007, 04:43 PM
  3. Ftp not working with WAS server yet?
    By oldtony in forum Web Application Server v7
    Replies: 4
    Last Post: 12-19-2005, 03:52 PM
  4. Is Alpha's FTP Server down?
    By Burt Adjoodani in forum Code Archive
    Replies: 0
    Last Post: 07-30-2001, 04:15 PM
  5. Is Alpha's FTP Server down?
    By Burt Adjoodani in forum Announcements
    Replies: 0
    Last Post: 07-30-2001, 04:14 PM

Bookmarks

Posting Permissions

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