Inet1.URL = "ftp://192.168.0.9"
    Inet1.Protocol = icFTP
    Inet1.AccessType = icUseDefault
    Inet1.RemoteHost = "192.168.0.9"
    Inet1.RemotePort = 22
    Inet1.UserName = ftpuser
    Inet1.Password = ftpuser
'    For Each Item In oFolder.Files
     curFile = Text1.Text 'oFolder.Path & "\" & Item.Name
     Inet1.Execute , "put " & curFile & "/user.txt"
'Next
err:
MsgBox err.Description, vbCritical, "上传错误"
这是我的一段程序,报告不能连接到主机,但是通过ie就没有问题,搞不懂了,谢谢各位大虾

解决方案 »

  1.   

    Inet1.RemoteHost = "192.168.0.9"
    Inet1.RemotePort = 22
    这两句可以不要了
    另外先要执行dir
        
    Private Sub Command1_Click()
      Dim StrMsg As String
      Dim isbusy As Boolean
      
      Inet1.URL = "ftp://www.xxx.com/"
      Inet1.Protocol = icFTP
      Inet1.UserName = "xxx"
      Inet1.Password = "xxx"
      
      StrMsg = "Dir"
      Inet1.Execute , StrMsg
      
    End SubPrivate Sub Command2_Click()
    On Error GoTo errhandle:
    Dim s1 As String
      
      Inet1.Execute , "Get 2.zip C:\234.zip"
      Do While isbusy
           isbusy = Inet1.StillExecuting
           DoEvents
      Loop
    errhandle:
        MsgBox Err.Description
    End SubPrivate Sub Inet1_StateChanged(ByVal State As Integer)
    Select Case State
     Case 1
        Text1.Text = "is looking"
    Case 2
        Text1.Text = "success finding "
    Case 3
      Text1.Text = "is connecting"
    Case 4
      Text1.Text = "success connected"
    Case 5
      Text1.Text = "is sending request"
    Case 6
      Text1.Text = "sucess sending"
    Case 7
      Text1.Text = "is receiving"
    Case 8
      Text1.Text = "success receive"
    Case 9
      Text1.Text = "is disconnecting"
    Case 10
      Text1.Text = "success disconnect"
    Case 11
      Text1.Text = "is error"
    Case 12 'icResponseCompleted
      Text1.Text = "success receive data"
      bDowning = False
    End Select
    End Sub