| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2006 人关注过本帖
标题:[求助]我的文件传送程序
只看楼主 加入收藏
redice
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:902
专家分:0
注 册:2006-12-11
收藏
得分:0 
回复 8# 的帖子
行不通不是因为你没有把所有数据都发出去而是因为你发的太快了,目的主机根本来不及处理。你的一个循环几秒中就结束了,对方可能只收到了一个包。

鲲鹏数据 - 专业Web数据采集服务提供者
http://www.
2007-11-30 13:02
abc5566
Rank: 1
等 级:新手上路
帖 子:201
专家分:0
注 册:2007-9-15
收藏
得分:0 
谢拉
2007-12-01 23:50
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
收藏
得分:0 
原帖由 [bold][underline]redice[/underline][/bold] 于 2007-11-22 20:56 发表 [url=http://bbs.][/url]
For i = 0 To lngfile
ReDim myfile(1023) As Byte
Open filename For Binary As #1
Get #1, i * 1024 + 1, myfile
Close #1
ws1.SendData myfile
DoEvents
Next i

不能这样发!要确定对方已收到上一数据包后再发下一 ...


很有启发意义
2007-12-02 09:47
penguit
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-5-16
收藏
得分:0 
强悍,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
学习中,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
2007-12-02 10:01
abc5566
Rank: 1
等 级:新手上路
帖 子:201
专家分:0
注 册:2007-9-15
收藏
得分:0 
请问redice,我模拟了你的一些程序,但为什么只传到了8k,帮我看看
Dim complete As Boolean
Dim fn As String
Dim fn1 As String
Dim fn2 As String
Dim num As Long
Private Sub Command1_Click()
With ws
 .RemoteHost = Text1.Text
 .RemotePort = 5000
End With
With ws2
.RemoteHost = Text1.Text
.RemotePort = 5001
End With
End Sub

Private Sub Command3_Click()
cd1.ShowOpen
Text2.Text = cd1.FileTitle
fn = "D:\唐\ad\" + cd1.FileTitle
ws2.SendData fn
End Sub

Private Sub Form_Load()
ws.LocalPort = 5000
ws.Bind
ws2.LocalPort = 5001
ws2.Bind
ws3.Bind 5002
num = 1
End Sub

Private Sub ws_DataArrival(ByVal bytesTotal As Long)
Dim filenum As Integer
Dim size() As Byte
ReDim size(bytesTotal)
ws.GetData size
filenum = FreeFile
Open fn2 For Binary As filenum
Put filenum, num, size
num = num + bytesTotal
Close filenum
End Sub

Private Sub ws2_DataArrival(ByVal bytesTotal As Long)
ws2.GetData fn1
fn2 = fn1
sendfile (cd1.FileName)
End Sub

Private Function sendfile(file As String)
Dim filenum As String
Dim i, m As Long
Dim size() As Byte
ReDim size(7168)
filenum = FreeFile
Open file For Binary As filenum
m = 1
i = 1
For i = 1 To LOF(filenum) \ 7168
   complete = False
   Get filenum, m, size
   m = i * 7168
   ws.SendData size
   DoEvents
   While Not complete
   DoEvents
   Wend
Next
 If Int(LOF(filenum)) > Int((LOF(filenum) \ 7168) * 7168) Then
       ReDim size(LOF(filenum) - (LOF(filenum) \ 7168) * 7168)
       Get filenum, m, size
       ws.SendData size
    End If
Close
End Function
2007-12-12 00:57
abc5566
Rank: 1
等 级:新手上路
帖 子:201
专家分:0
注 册:2007-9-15
收藏
得分:0 
帮帮忙啊,很急啊
2007-12-12 23:56
快速回复:[求助]我的文件传送程序
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012162 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved