Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 22,508 times

Related Categories

Giving the Inet Control time to execute commands

When you use the Inet control to access an FTP site, you'll often
need to issue commands in pairs. For instance, to change from one
directory to another and then display the new directory's structure,
you'll need to first issue the CD (change directory) command, followed
by the DIR (directory) command.

However, in Visual Basic, if you try to execute these commands one
right after another, the Inet control will most likely return an error.
That's because, depending on the connection speed used to access the
FTP site, Visual Basic issues the second command before the FTP site
has had a chance to complete the first command.

To avoid this error, you'll need to wait until the FTP site has finished
processing one command before continuing on to another. To do so, you
can test the Inet control's StillExecuting property. As you can guess,
this property indicates whether or not the last command is still
executing. It returns True if so, and False if not. To take full
advantage of this property, set it up in a loop in conjunction with
the DoEvents keyword, like so:

Private Sub myButton_Click()
With Inet1
   .Execute , "CDUP"
   Do While .StillExecuting
      DoEvents
   Loop
   .Execute , "DIR"
End With
End Sub

© 2001 Element K Journals, a division of Element K Press LLC ("Element K"). Element K and the Element K logo are trademarks of Element K LLC

Comments

  • Inet Control

    Posted by venkatesharalikatti on 01 Nov 2003


    i am using inet control to upload the files through FTP. First one hour files are uploading then after they are not. What is a problem ? is the time limit to upload the files or some other reason.

  • No your partially wrong

    Posted by furiousj on 26 Jan 2003

    Yes if you put inet.stillexecuting in a loop it will freeze but not when you put DoEvents in the loop which gives access back to the OS. Then it works like a dream. I have been perplexed at how to r...

  • Posted by Thushan Fernando on 26 May 2002

    lmao,,,,,,

    infringment of trademarks,,,,,,,,,,,, dammm!

  • Posted by qwijibow on 26 May 2002

    well yeah !!,,,,,,,,,,
    u see that was a long pause,, whereas that pause was quite short !!,,


    where would we be without commmas,,,,,,,,,,,,,,,

    i mean ,,

    in every day life,, we all use diffe...

  • Posted by Thushan Fernando on 25 May 2002

    as long as your happy:D I'm happy too! ;)

    I've just noticed(I'm getting blinder everyday;)) your comma's are trippled. wtf? is that normal cause i can do a , and not get 3! Or are you just too sp...