跪求VB 6.0编的利用Winsock控件实现的局域网文件传输程序解决办法

跪求VB 6.0编的利用Winsock控件实现的局域网文件传输程序本人刚接触VB,但又急要VB6.0编的利用Winsock控件

跪求VB 6.0编的利用Winsock控件实现的局域网文件传输程序
本人刚接触VB,但又急要   VB   6.0编的利用Winsock控件实现的局域网文件传输程序     求求大虾们帮帮忙啊,发到我邮箱:samsunglu@hotmail.com万分感谢。
分不够还可以在给

[解决办法]
BS:男人膝下有黄金,不要动不动就下跪!
http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=54669&lngWId=1
http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=46633&lngWId=1
http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=59815&lngWId=1
http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=59273&lngWId=1
http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=54071&lngWId=1
http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=59324&lngWId=1
http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=44801&lngWId=1
http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=52837&lngWId=1
http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=59812&lngWId=1
http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=36448&lngWId=1
http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=50253&lngWId=1

[解决办法]
服务器代码:
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 ProgressBar1.Value = ProgressBar1.Max Then MsgBox "OK "

End Sub

Private Sub Form_Load()
Winsock1.Protocol = sckTCPProtocol
Winsock1.LocalPort = 2001
Winsock1.Listen

FormCLI.Show
End Sub

Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> 0 Then Winsock1.Close
Winsock1.Accept requestID

End Sub


客户端代码:
Option Explicit

Private Sub Form_Load()
With Winsock1
.Protocol = sckTCPProtocol
.RemoteHost = "192.168.0.69 "
.RemotePort = 2001
.Connect
End With

End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Static i As Long
Dim myFile() As Byte
Dim myLong As Double
Dim myPath As String
myPath = "d:\abc.MDB "
ReDim myFile(bytesTotal - 1) '此处也可以是(0 To bytesTotal-1)
Winsock1.GetData myFile

Open myPath For Binary As #1 '新建文件
myLong = FileLen(myPath)
Put #1, myLong + 1, myFile '将收到的数据写入新文件中
Close #1 '关闭
End Sub

不管什么文件,都转化为2进制传送!!!不过对方要知道你发送的是什么类型的文件,好不扩张名不知道怎么写,这个你就增加一个数据 包,包里面包含此文件的扩张名即可!
[解决办法]
就是..就是 ...同意楼上的说法!


要代码,要工程,要方法,要....都可以,就不可以随便 "跪求 "!


网上这种代码 "文件传输(wscksendfile).rar ",呵呵,搜索一下也有!

我也有现成的!