原帖由 [bold][underline]redice[/underline][/bold] 于 2007-11-22 20:56 发表 [url=http://bbs.]" border="0" />[/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
请问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