为什么inet控件会传不上去?
具体是生成一个文本文件,然后传到一台主机上去。现在是有的机器传不上去,有的可以。都是XP SP3的系统。传不上去的机器到最后还是显示“上传完毕!”,但在主机上就是没有。没有防火墙。VB运行库也安装了。贴上代码让大家帮忙看一下。那个MSINET.OCX和程序都在一个文件夹里。
Private Sub Command2_Click() '上传文件
'If Pings(Trim(Text3.Text)) = False Then '检查网络是否连通
' MsgBox "网络不通,请检查主机IP和网络连接!", vbInformation, "提示"
' Exit Sub
'End If
If Trim(Combo1.Text) = "" Then
MsgBox "请输入机构登陆名!", vbInformation, "提示"
Combo1.SetFocus
Exit Sub
ElseIf Trim(Text2.Text) = "" Or Dir(App.Path & "\" & Trim(Text2.Text) & ".txt") = "" Then
MsgBox "您输入的文件不存在,请重新输入!", vbInformation, "提示"
Text2.SetFocus
Exit Sub
ElseIf Trim(Text3.Text) = "" Then
MsgBox "请输入主机IP地址!", vbInformation, "提示"
Text3.SetFocus
Exit Sub
ElseIf Trim(Text1.Text) = "" Then
MsgBox "请输入root用户密码!", vbInformation, "提示"
Text1.SetFocus
Exit Sub
End If
On Error GoTo Error1
Inet1.Protocol = icFTP '传输方式为 FTP
Inet1.RemoteHost = Trim(Text3.Text) '主机地址
Inet1.URL = "ftp://" & Trim(Text3.Text)
Inet1.RemotePort = 21 '端口号
Inet1.UserName = "root" '主机用户
Inet1.Password = Trim(Text1.Text) '主机密码
Inet1.Execute , "put " & App.Path & "\" & Trim(Text2.Text) & ".txt" & " /usr/" & Trim(Combo1.Text) & "/udtfile/" & Trim(Text2.Text) & ".txt" 'FTP传送指定文件
Do While Inet1.StillExecuting '判断FTP传输是否结束
DoEvents
Loop
Inet1.Execute , "close"
Inet1.Execute , "quit"
Kill App.Path & "\" & Trim(Text2.Text) & ".txt"
MsgBox "上传完毕!", vbInformation, "提示"
Exit Sub
Error1:
MsgBox Err.Description & ",请检查用户名、主机IP、密码及网络连接!", vbInformation, "提示"
Err.Clear
End Sub