先是出现正在连接,然后是“无法连接到服务器”或“与主机通讯时出现错误”。
这是哪里有问题,最好帮忙改正并写出程序解释。
另外用这个是否能正常工作,最好能有改正完善的地方,谢谢谢谢!Private Sub Command1_Click()
Inet1.url = "ftp://username:password@hostname/document"
  Inet1.Protocol = 2 - icFTP
  Inet1.RemoteHost = "http://127.0.0.1"
  Inet1.RemotePort = 21
  Inet1.UserName = "Administrator"
  Inet1.Password = 5555
'执行文件传输:
Inet1.Execute "ftp://username:password@hostname PUT" & local_filename & "UPLOAD1.TXT"  right1 = Inet1.StillExecuting
  Do While right1
   right1 = Inet1.StillExecuting
   DoEvents
  LoopEnd Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
   Select Case State
    Case 1
        Text1.Text = "正在查询所指定的主机的IP地址"
    Case 2
        Text1.Text = "成功地找到所指定的主机的IP地址"
    Case 3
        Text1.Text = "正在与主机连接"
    Case 4
        Text1.Text = "已与主机连接成功"
    Case 5
        Text1.Text = "正在向主机发送请求"
    Case 6
        Text1.Text = "发送请求已成功"
    Case 7
        Text1.Text = "在接收主机的响应"
    Case 8
          Text1.Text = "成功地接收到主机的响应"
          'Inet1.Execute "", "PUT d:\1.txt 1.txt"
'ri = Inet1.StillExecuting
'Do While ri
'ri = Inet1.StillExecuting
'DoEvents
'Loop
    Case 9
        Text1.Text = "正在解除与主机的连接"
    Case 10
          Text1.Text = "已成功地与主机解除了连接"
    Case 11
          Text1.Text = "与主机通讯时出现了错误"
    Case 12
          Text1.Text = "请求已经完成,并且所有数据均已接收到"
    End Select
End Sub

解决方案 »

  1.   

    或者高手能帮忙解释一下下面这段程序,感谢。Inet1.Execute , "MKDIR Image"
        
        t = Timer
        Do While Inet1.StillExecuting And Not (Timer - t > 10)
         On Error Resume Next
         If t > Timer Then t = t - 86400
         DoEvents
        Loop
        
        Inet1.Execute , "MKDIR Image/" & UserName
        
        t = Timer
        Do While Inet1.StillExecuting And Not (Timer - t > 10)
         On Error Resume Next
         If t > Timer Then t = t - 86400
         DoEvents
        Loop 
        Inet1.Execute , "PUT " & App.Path & "/1.JPG Photos/1.JPG"
        
        t = Timer
        Do While Inet1.StillExecuting And Not (Timer - t > 10)
         On Error Resume Next
         If t > Timer Then t = t - 86400
         DoEvents
        Loop    Inet1.Cancel
      

  2.   

    显示成功与服务器连接和断开,但是却没有任何效果,没有传上去文件,没任何改变,是何故呢?Private Sub Command1_Click()
    Dim t As Double    Inet1.url = "ftp://xxx.xxx.xxx.xxx"
      Inet1.Protocol = icFTP
      Inet1.RemoteHost = "xxx.xxx.xx.xxx"
      Inet1.RemotePort = "21"
      Inet1.UserName = "xxxxxx"
      Inet1.Password = "xxxxxx"    Inet1.Execute , "MKDIR Image"
        
        t = Timer
        Do While Inet1.StillExecuting And Not (Timer - t > 10)
         On Error Resume Next
         If t > Timer Then t = t - 86400
         DoEvents
        Loop
        
        Inet1.Execute , "MKDIR Image/" & UserName
       
        
        t = Timer
        Do While Inet1.StillExecuting And Not (Timer - t > 10)
         On Error Resume Next
         If t > Timer Then t = t - 86400
         DoEvents
        Loop 
        Inet1.Execute , "PUT " & FilePathName & " Image/" & UserName & "/" & FileName & "d.jpg"
        
        'MsgBox FilePathName & " Image/" & UserName & "/" & FileName & "d.jpg"
        
        t = Timer
        Do While Inet1.StillExecuting And Not (Timer - t > 10)
         On Error Resume Next
         If t > Timer Then t = t - 86400
         DoEvents
        Loop    Inet1.CancelEnd Sub'Private Sub Command1_Click()
    'Inet1.Protocol = icFTP
       ' Inet1.URL = "ftp://127.0.0.1/"
       ' Inet1.RemotePort = 21
       ' Inet1.UserName = "Administrator"
       ' Inet1.Password = "5555"
       ' Inet1.OpenURL
        
        'End SubPrivate Sub Inet1_StateChanged(ByVal State As Integer)
       Select Case State
        Case 1
            Text1.Text = "正在查询所指定的主机的IP地址"
        Case 2
            Text1.Text = "成功地找到所指定的主机的IP地址"
        Case 3
            Text1.Text = "正在与主机连接"
        Case 4
            Text1.Text = "已与主机连接成功"
        Case 5
            Text1.Text = "正在向主机发送请求"
        Case 6
            Text1.Text = "发送请求已成功"
        Case 7
            Text1.Text = "在接收主机的响应"
        Case 8
              Text1.Text = "成功地接收到主机的响应"
    '          Inet1.Execute "", "PUT d:\1.txt 1.txt"
    'ri = Inet1.StillExecuting
    'Do While ri
    'ri = Inet1.StillExecuting
    'DoEvents
    'Loop
        Case 9
            Text1.Text = "正在解除与主机的连接"
        Case 10
              Text1.Text = "已成功地与主机解除了连接"
        Case 11
              Text1.Text = "与主机通讯时出现了错误"
        Case 12
              Text1.Text = "请求已经完成,并且所有数据均已接收到"
        End Select
    End Sub