# WinSock的传输问题

Posted by 林文国 on February 11, 1998 at 19:09:38:

There is a problem about WinSock for me when I use it for transmitting a file between two nodes. My program is writting as follows

In Clint node:

Dim temp(1026) As Byte

Open "test.wav" For Binary As #1

For i = 1 To 1024
Get #1, , temp(i)
Next i
tcpClient.SendData temp
Close #1

In Server node:

Dim ttt '(1026) As Byte
Dim i As Integer
Open "test2.wav" For Binary As #2

sckServer(index).GetData ttt, vbArray + vbByte
For i = 1 To 1024
Put #2, , ttt(i)
Next i
close #2

My problem is that i can receive and transmit successfully when i define ttt as variant type, but it will cause a problem for the instruction "put #2,,ttt(i)", which will add some unwanted byte into opened file since ttt is variant. To slove this problem, I define ttt() as byte. But a new problem is appeared. It is all the contents of ttt() are zeros. Why this problem occurs?

Thank in advance

Follow Ups:

- 观念不正确 小吴 19:44:34 2/17/98 (0)