王乐君演过的电视剧:为什么ftp服务器走到LIST时停下来?

来源:百度文库 编辑:中科新闻网 时间:2024/04/29 12:21:55
我在VB6中使用了 Internet Transfer控件,通过ftp协议向服务器上传文件,然后我用“Winsock Expert”软件监视,为什么每次返回LIST的内容后就停下来了不走了?State最后的状态是11(icError-与主机通讯时出现了错误)

我的command1_click是:
Inet1.OpenURL
Inet1.Execute , "GET a.txt c:\a.txt"
Inet1.Execute , "QUIT"

我在“StateChanged”事件是这样的:
Private Sub Inet1_StateChanged(ByVal State As Integer)

Select Case State

Case 0
Debug.Print "0:icNone-无状态可报告"
Case 1
Debug.Print "1:icHostResolvingHost-正在查询所指定的主机的"
Case 2
Debug.Print "2:icHostResolved-已成功地找到所指定的主机的"
Case 3
Debug.Print "3:icConnecting-正在与主机连接"
Case 4
Debug.Print "4:icConnected-已与主机连接成功"
Case 5
Debug.Print "5:icRequesting-正在向主机发送请求"
Case 6
Debug.Print "6:icRequestSent-发送请求已成功"
Case 7
Debug.Print "7:icReceivingResponse-正在接收主机的响应"
Case 8
Debug.Print "8:icResponseReceived-已成功地接收到主机的响应"
Case 9
Debug.Print "9:icDisconnecting-正在解除与主机的连接"
Case 10
Debug.Print "10:icDisconnected-已成功地与主机解除了连接"
Case 11
Debug.Print "11:icError-与主机通讯时出现了错误"
Debug.Print "code:" & Inet1.ResponseCode & "-" & Inet1.ResponseInfo & "!"
Case 12
Debug.Print "12:icResponseCompleted-该请求已经完成,并且所有数据均已接收到"
vtData = Inet1.GetChunk(1024, icString)
DoEvents
Do While Not bDone
strData = strData & vtData
DoEvents
vtData = Inet1.GetChunk(1024, icString)
If Len(vtData) = 0 Then
bDone = True
End If
Loop

End Select

Case 12
.......

'此处:参数是0,不是icString。不知道你是笔误还是真就这么写的?

vtData = Inet1.GetChunk(1024, 0)
'下面没发现错误。
DoEvents
Do While Not bDone
strData = strData & vtData
DoEvents
vtData = Inet1.GetChunk(1024, icString)
If Len(vtData) = 0 Then
bDone = True
End If
Loop

感觉你是在从服务器上下载a.txt文件,而不是上传.
Inet1.OpenURL
Inet1.Execute , "GET a.txt c:\a.txt"
Inet1.Execute , "QUIT"

可能因为服务器上没有,所以停下来.

这样
Private Sub Command1_Click()
Inet1.Protocol = icFTP
Inet1.URL = "ftp://用户名:密码@192.168.0.1/" '服务器
Inet1.Execute , "a.txt c:\a.txt"
End Sub

另外Inet1.Execute , "QUIT"
不能马上执行。否则会出错。因为上一个语句未执行完。必须做个延时等上一句执行完才能执行。这里我略过了。

看来这个问题有难度,你还是去计算机论坛寻求帮助吧!