# 关于winsock传二进制档案..

Posted by Buier on October 24, 1999 at 02:39:03:

请问各位高手,小弟想要透过winsock在网路中传送档案,但是遇到了一个
很奇怪的难题..试了好几个晚上,从原本大的执行档传送到最后自己开纯
文字档几byte 的传送都会遇到问题..
其中有几个疑问的地方,用winsock传资料时是不是要在当中加上延迟??
程式中是以msgbox 来延迟的.因为如果不加的话资料收的更乱七八糟..
会的高手请您花一点时间会小弟解惑吧..

p.s 子琏兄如果你有看到的话请你帮忙小弟一下,赫密斯软体真的写的很
棒.

'两个winsock 传资料的主要程式片断

Dim Arry(10000) As Byte, Cnt As Double
'这里是传送部分的程式片断
Private Sub Command1_Click()
Dim T As Byte, T1 As Double
Open "C:\1.txt" For Binary Access Read As #1
For T1 = 1 To FileLen("C:\1.txt")
Get #1, , T
A = DoEvents()
MsgBox "Server:" + Str$(T)
sckSer.SendData T
Next
Close
MsgBox "Send Over"
End Sub
'这里是接收部分的片段
Private Sub sckSer_ConnectionRequest(ByVal requestID As Long)
sckSer.Close
sckSer.Accept requestID
End Sub
'存档,放至 Arry() as byte
Private Sub Command4_Click()
Dim T1 As Double
Open "C:\2.txt" For Binary Access Write As #2
For T1 = 0 To Cnt
Put #2, , Arry(T1)
A = DoEvents()
Next
Close #2
MsgBox "Saved"
End Sub

- VB心得交流网

Follow Ups:

- Re: 关于winsock传二进制档案.. 琏琏 17:57:44 10/26/99 (0)
- 你程式有漏给吧! 小吴 22:23:57 10/24/99 (1)
  - Re: 我重新post, 发现了新的问题了.. Buier 04:38:28 10/25/99 (0)