当客户端向服务器端发送数据时,若发送的是string,则服务器端的dataarrival事件中的bytestotal正常,若以byte形式发送则bytestotal却无论如何都为1,请问这是怎么回事呢
源程序
发送端
Private Sub Command1_Click()
CommonDialog1.ShowOpen
Dim myfile() As Byte
Dim position As Long
Open CommonDialog1.FileName For Binary As #1
position = 0
Do While Not EOF(1)
position = positon + 1
ReDim Preserve myfile(1 To position)
Get #1, , myfile(position)
Loop
Close #1
sckserver(1).SendData myfile
End Sub
接收端
Private Sub sckconnect_DataArrival(ByVal bytesTotal As Long)
CommonDialog1.ShowOpen
Dim receivefile(1 To bytesTotal) As Byte
sckconnect.GetData receivefile, vbArray + vbByte
Open CommonDialog1.FileName For Binary As #1
For I = 1 To bytesTotal
Put #1, , receivefile(I)
Next I
Close #1
End Sub