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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"still executing last request"

Status
Not open for further replies.

99mel

Programmer
Oct 18, 1999
379
GB
I'm getting the following error each time i try to execute an ftp command using Internet control Transfer component.

Any suggestions on how i can stop this executing request??
 
Basically, you "ignore" that error - you need to go into a wait state until the FTP command has completed. In the code that actually executes the command, I would suggest something like the following:

inetFTPControl.Execute , fStr_FTPCommand
While inetFTPControl.StillExecuting
DoEvents
Wend

and in the StateChanged event handler you do what is necessary after completing of the command

Private Sub inetFTPControl_StateChanged(ByVal rInt_FTPState As Integer)

Select Case rInt_FTPState
Case icError
<Handle the Error>
Case icResponseCompleted
<Handle the Completion of Command>
Case icNone
Case icResolvingHost
Case icHostResolved
Case icConnecting
Case icConnected
Case icRequesting
Case icRequestSent
Case icReceivingResponse
Case icResponseReceived
Case icDisconnecting
Case icDisconnected
End Select

End Sub

Hope this helps Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
There is a VB instruction called DoThings(). What this
does is make the current subroutine see if there are any
other events that also need to be &quot;taken care of&quot; (such
as terminating the program when a button is clicked, etc).
 
cheers CajunCenturion! thats a great help!

I put doevent loops after each execute statement now!

however its not going into the StateChanged procedure.

I'm firing of a PUT statement, and then a DIR statement. The file i'm trying to put into the ftp path does not get copied and the statechanged procedure does not fire off for the dir results.

Any ideas?

I get no errors however!
 
The StateChanged is an event of the Inet control. I would suggest that first rename your existing StateChange event subroutine to some other name. Then you double click on the control from the from, and that should create the proper event handler. Then you can copy the code from your renamed procedure into the newly created event handler.

To handle the results from the DIR Command, you'll need to use the .GetChunk method of the INET control to get the directory listing.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
yep... the Statechanged event was part of the Inet control, however i have done what u suggested anyhoo.

It still doesn't go into the procedure at all though.

I'm doing a Inet.Cancel at the end.... this is the correct way to close the connection isn't it? I do a execute.'Close' before this.
 
Perhaps you should post the code Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Inet1.AccessType = icUseDefault
Inet1.URL = &quot;ftp://ip and port no/&quot;
Inet1.UserName = &quot;******&quot;
Inet1.Password = &quot;******&quot;
Inet1.Execute , &quot;cd 0828&quot;
Do While Inet1.StillExecuting
DoEvents
Loop

Inet1.Execute , &quot;PUT temp.pam&quot;
Do While Inet1.StillExecuting
DoEvents
Loop

Inet1.Execute , &quot;dir&quot;
Do While Inet1.StillExecuting
DoEvents
Loop

Inet1.Execute , &quot;CLOSE&quot;
Do While Inet1.StillExecuting
DoEvents
Loop
Inet1.Cancel

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

Private Sub Inet1_StateChanged(ByVal State As Integer)
Dim lStr_ErrorMsg As String
Dim vtData As Variant ' Data variable.

'never gets here

Select Case rInt_FTPState
Case icError
lStr_ErrorMsg = &quot;Code: &quot; & Inet1.ResponseCode & &quot; : &quot; & Inet1.ResponseInfo
MsgBox lStr_ErrorMsg
FTPError = True
Inet1.Cancel

Case icResponseCompleted
vtData = Inet1.GetChunk(1024)
MsgBox vtData
Case icNone
Case icResolvingHost
Case icHostResolved
Case icConnecting
Case icConnected
Case icRequesting
Case icRequestSent
Case icReceivingResponse
Case icResponseReceived
Case icDisconnecting
Case icDisconnected
End Select
End Sub
 
It could be that the event is being fired, but since the input parameter is called State, and the case statement variable is rInt_FTPState, the Case statement doesn't do anything. Either change the Parameter name, or the case statement variable.

There is no reason to have the .Cancel method where you have it. I would however, put the .Cancel in the error handling section of the StateChange event.

I don't know what the FTP server on the other end is doing, but I perfer on the PUT command to explicity identify the location and name of the file that I'm copying up. Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
oops... the case statement wont help then. hehe

However i have a msgbox on the first line of the state change procedure, and this has never been fired! Its just not going into the state procedure *shrugs*

will look at the PUT command and add the full file lengths, but the 'dir' statement should surely fire the state procedure??
 
WOHOOO just to let u know.. ive got it working now.

I had the code above in the form load procedure, I moved it into a button click event and this then fired off the State change procedure.

A few adjustments and its working how i want it now!

Cheers 4 ur help!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top