
If the Ftp_Server have no file.......the program will hold and not working ......please help me~
I design a ftp program by use inet controls ~
this is my code:
FtpLink.Execute "ftp://127.0.0.1", "dir"
If the Ftp_Server have no file.......the program will hold and not working
why???
and how to solve the problem...
thanks a lot~
Steven.
it is some of the complete code?G
Private Sub Form_Load()
FileDirReflash = True
FtpLink.Execute "ftp://127.0.0.1", "dir"
End Sub
Private Sub FtpLink_StateChanged(ByVal STATE As Integer)
Dim vtData As Variant
Dim strData As String: strData = ""
Dim bDone As Boolean
Dim i As Integer
Dim j As Integer
Dim strData1 As String
Dim strData2 As String
Dim GetFile As String
Select Case STATE
'Case icError
' MsgBox "error"
'Case icReceivingResponse
' MsgBox "error"
Case icResponseCompleted
If FileDirReflash Then
vtData = FtpLink.GetChunk(1024, icString)
DoEvents
Do While Not bDone
strData = strData & vtData
vtData = FtpLink.GetChunk(1024, icString)
DoEvents
If Len(vtData) = 0 Then
bDone = True
End If
Loop
i = 1
FileList.Clear
Do While InStr(i, strData, vbCrLf) <> 0
strData1 = Trim(Mid(strData, i, InStr(i, strData, vbCrLf) - i))
strData2 = ""
For j = 1 To Len(strData1)
If Asc(Mid(strData1, j, 1)) > 31 And Asc(Mid(strData1, j, 1)) < 127
Then strData2 = strData2 & Mid(strData1, j, 1)
Next j
If Len(Trim(strData2)) <> 0 Then
If Right(strData2, 1) = "/" Then strData2 = "/" & Left(strData2,
Len(strData2) - 1)
FileList.AddItem strData2
End If
i = InStr(i, strData, vbCrLf) + 1
Loop
Timer1.Enabled = True
End If
End Select
End Sub