Announcement

Collapse
No announcement yet.

FTP Shell error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • FTP Shell error

    I've got a program that shells out and runs a script in ftp,

    ShellLine$ = "ftp -n -s:"+scriptfile$+" "+ftpserver$+" > "+outputfile$
    SHELL ShellLine$

    When the user enters the wrong password or loses a connection
    the program errors out with a 208. What happens is an extra line
    is printed, it's not going to the outputfile. I could trap 208
    but that seems to me that I'm fixing a symptom instead of the
    problem.
    TIA

    ------------------

  • #2
    Unfortunately, your description is a little too vague to provide a specific response.

    What FTP program are you using? What TCP/IP stack? What O/S? How much memory is available to the FTP program when you SHELL to it? Are you using UltraSHELL to maximize memory to the SHELLed app?

    Usually a 208 indicates a memory corruption error - this can happen if the SHELLed process uses memory carelessly (ie, writes over memory it should not do) or is not well constructed to deal with error conditions such as out-of-memory. Ditto for your program: if you do not checked array bounds use, etc, then you could be creating the error yourself somewhere.

    Be sure to add $ERROR ALL ON to the top of you PB/DOS code and try again. If all else fails, tell us more about the exact situation (memory usage, etc).

    Please let us know how you get on.

    Thanks!


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      We're running the program on Win98 and Win98SE, the ftp program and TCP/IP is the standard software included with the O/S.
      I'm not sure if this is the memory info your asking for, 584K free in DOS box, all memory values set to Auto in properies window. We are using UltraShell v1.07 with this program.

      FTP Script

      user someone
      password
      binary
      get filename.zip
      quit

      I've run this from a command line with this output
      c:\>ftp -n -s:script ftpserver.com > output.txt'
      Login failed.

      c:\>

      With valid information nothing is printed between the prompts, the problem appears to be when an error message is generated. I'm parsing the output file for errors so I don't really need to use returned error message.

      ------------------

      Comment


      • #4
        Assuming the FTP program isn't doing something perverse, like bypassing DOS output altogether... the error information is going to STDERR rather than STDOUT. Unfortunately, Microsoft never did provide the command shell with a way to redirect STDERR. It's possible to redirect STDERR if you know the right tricks but, it's been so many years, I can't recall how.

        ------------------
        Tom Hanlin
        PowerBASIC Staff

        Comment


        • #5
          Did you try my suggestion of adding $ERROR ALL ON to the code?

          Also, does FTP.EXE return an error code in this condition?

          Since you are using Ultrashell, you could try using some of the error recall functions it provides to return the error code that is returned by the SHELLed application. See the Ultrashell documentation for more information.



          ------------------
          Lance
          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          Lance
          mailto:[email protected]

          Comment


          • #6
            The FTP.EXE included with Win9x is a Win32 console program.
            This means that DOS is most likely not handling the errors.

            I hope this helps people in finding an answer to Billy's problem.

            Wouldn't it be easier to just write the program using PB/CC if
            your going to be using it on Windows machines? There is only
            one way to make FTP.EXE run under plain DOS, and I doubt it
            would work anyway, since the your Winsock would be gone.



            ------------------
            Amos

            Comment


            • #7
              Console applications absolutely *can* return an ERRORLEVEL value to the calling DOS application, but whether FTP.EXE does this or not is another question.




              ------------------
              Lance
              PowerBASIC Support
              mailto:[email protected][email protected]</A>
              Lance
              mailto:[email protected]

              Comment


              • #8
                The program has been compiled with $ERROR ALL ON. I've checked the Ultrashell status and it doesn't report an error.


                ------------------

                Comment


                • #9
                  Maybe you need to look for an alternative FTP agent to use with your code... there must be some around that provide a "command-line interface".

                  ------------------
                  Lance
                  PowerBASIC Support
                  mailto:[email protected][email protected]</A>
                  Lance
                  mailto:[email protected]

                  Comment


                  • #10
                    Plenty-

                    DOS Only- http://www.simtel.net/simcgi-bin/dos...queryinput=ftp

                    Win9x Console- http://www.simtel.net/pub/simtelnet/...k/nftp161w.zip

                    PoweBASIC FTP Client engine- http://www.simtel.net/pub/simtelnet/...g/fce4pb20.zip

                    I think the fce4pb20.zip is for PB/CC, since it was listed under
                    Win95...then again, it could just be in the wrong place.


                    ------------------
                    Amos

                    Comment


                    • #11
                      Out of curiosity, I wrote a 4DOS batch file to capture errorlevels
                      of programs. I tested ftp.exe with a number of different conditions
                      including the specified one. I forced ftp.exe to fail numerous times
                      and each time it returned 0, which means it does *not* return an
                      ERRORLEVEL.


                      ------------------
                      Amos

                      Comment


                      • #12
                        The "free stuff" that comes with Operating Systems is not always the most useful... caveat emptor...


                        ------------------
                        Lance
                        PowerBASIC Support
                        mailto:[email protected][email protected]</A>
                        Lance
                        mailto:[email protected]

                        Comment

                        Working...
                        X