Home > Software engineering >  VB use INET control production FTP download, download Windows 7 normal, XP, but won't they?
VB use INET control production FTP download, download Windows 7 normal, XP, but won't they?

Time:09-20

The XP system, the state always icReceivingResponse died due to timeout failed download


Option Explicit

Private m_GettingDir As Boolean
Private Sub AddMessage (ByVal MSG As String)
TxtResults. Text=txtResults. Text & amp; VbCrLf & amp; MSG
TxtResults. SelStart=Len (txtResults. Text)
End Sub

Private Sub cmdDownload_Click ()
Dim host_name As String

Enabled=False
MousePointer=vbHourglass
TxtResults. Text="Working"
TxtResults. SelStart=Len (txtResults. Text)
DoEvents
Host_name=txtHost. Text
If LCase $(Left $(host_name, 6)) & lt;> "Ftp://" Then host_name="ftp://" & amp; Host_name
InetFTP. URL=host_name

InetFTP. UserName=txtUserName. Text
InetFTP. Password=txtPassword. Text
InetFTP. Execute, "Get" & amp; TxtRemoteFile. Text & amp; "" & amp; TxtLocalFile. Text

End Sub

Private Sub cmdUpload_Click ()
Dim host_name As String
Enabled=False
MousePointer=vbHourglass
TxtResults. Text="Working"
TxtResults. SelStart=Len (txtResults. Text)
DoEvents
Host_name=txtHost. Text
If LCase $(Left $(host_name, 6)) & lt;> "Ftp://" Then host_name="ftp://" & amp; Host_name
InetFTP. URL=host_name

InetFTP. UserName=txtUserName. Text
InetFTP. Password=txtPassword. Text
InetFTP. Execute, "Put" & amp; TxtLocalFile. Text & amp; "" & amp; TxtRemoteFile. Text
End Sub

Private Sub inetFTP_StateChanged (ByVal State As an Integer)
Select the Case State
Case icError
AddMessage "Error:" & amp; _
"" & amp; InetFTP. ResponseCode & amp; VbCrLf & amp; _
"" & amp; InetFTP. ResponseInfo
Case icNone
AddMessage "None"
Case icConnecting
AddMessage "connection"
Case icConnected
AddMessage "connection"
Case icDisconnecting
AddMessage "disconnect"
Case icDisconnected
AddMessage "disconnect"
Case icRequestSent
AddMessage "request"
Case icRequesting
AddMessage "request"
Case icReceivingResponse
AddMessage "receiving the response"
Case icRequestSent
AddMessage "request"
Case icResponseReceived
AddMessage "reply"
Case icResolvingHost
AddMessage "resolve host
"Case icHostResolved
AddMessage "host resolution
"
Case icResponseCompleted
AddMessage inetFTP. ResponseInfo

If m_GettingDir Then
Dim TXT As String
Dim the chunk As Variant
M_GettingDir=False
The chunk=inetFTP. GetChunk (1024, icString)
DoEvents
The Do While Len (the chunk) & gt; 0
TXT=TXT & amp; The chunk
The chunk=inetFTP. GetChunk (1024, icString)
DoEvents
Loop

AddMessage "-- -- -- -- -- -- -- -- -- --"
AddMessage TXT
End the If

In Case the Else
AddMessage "State=" & amp; The Format $(State)
End the Select

Enabled=True
MousePointer=vbDefault
End Sub

CodePudding user response:

Under XP using FTP commands or other FTP software such as normal FlashFxp can download?