请大家帮我看看哪里错了:我用了udp连接,另外复制了此程序做为通信的另一方,请大家务必帮我解决
请问如果放在不同机上能否传txt文件?
Dim a As String
Private Sub Command1_Click()
Dim bytdate() As Byte
Dim filename As String
Dim lngfile As Long
Dim i As Long
filename = Dir1.Path + "\" + File1.filename
lngfile = FileLen(filename) \ 1024
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
End Sub
Private Sub Command2_Click()
With ws1
.RemoteHost = Text1.Text
.RemotePort = 5001
.Bind 5001
End With
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub Form_Load()
a = File1.filename
End Sub
Private Sub ws1_DataArrival(ByVal bytesTotal As Long)
Static i As Long
Dim myfile() As Byte
Dim mylong As Double
Dim mypath As String
Dim fn As Integer
fn = FreeFile
mypath = "d:\a\a.txt
ReDim myfile(bytesTotal - 1)
ws1.GetData myfile
fn = FreeFile
Open mypath For Binary As #fn
Put #fn, mylong + 1, myfile
Close #fn
End Sub
[此贴子已经被作者于2007-11-21 1:53:17编辑过]