winsock传输文件

来源:百度知道 编辑:UC知道 时间:2024/05/17 01:26:20
求完整代码,最好就是简单明了。不要搞个太复杂的。
能实现传输文件就行了。

注意是VB的喔!
等待…………急需
发现有好的答案就送多50~~

嘿嘿。
服务器代码:
Option Explicit

Private Sub Command1_Click()
Dim BytDate() As Byte
Dim FileName As String
Dim lngFile As Long
Dim i As Long
FileName = "D:\Image\Oct2003.MDB " '取得文件名及路径
lngFile = FileLen(FileName) \ 1024 '取得文件长度
Me.ProgressBar1.Min = 0
Me.ProgressBar1.Max = lngFile + 1
ProgressBar1.Value = 0
For i = 0 To lngFile
ReDim myFile(1023) As Byte '初始化数组
Open FileName For Binary As #1 '打开文件
Get #1, i * 1024 + 1, myFile '将文件写入数组
Close #1 '关闭文件
Winsock1.SendData myFile '发送
DoEvents
ProgressBar1.Value = ProgressBar1.Value + 1
Next i
If Progr