1911.html

来自「VB技巧问答10000例 VB技巧问答10000例」· HTML 代码 · 共 25 行

HTML
25
字号
<html>  <head>    <title>WinSock的传输问题</title>  </head>  <BODY BACKGROUND="" BGCOLOR="white" TEXT="black" LINK="red" VLINK="#808080" ALINK="">    <center>      <h1>WinSock的传输问题</h1>    </center><HR><p>Posted by <a href="mailto:lwg@cri.tatung.com.tw">林文国</a> on February 11, 1998 at 19:09:38:<p>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<p>In Clint node:<p>Dim temp(1026) As Byte<p>Open "test.wav" For Binary As #1<p>     For i = 1 To 1024<br>        Get #1, , temp(i)<br>    Next i<br>   <br>    tcpClient.SendData temp<br> <br>Close #1<p><br>In Server node:<p>Dim ttt '(1026) As Byte<br>Dim i As Integer<br>	<br>     Open "test2.wav" For Binary As #2<p>     sckServer(index).GetData ttt, vbArray + vbByte<br> <br>        For i = 1 To 1024<br>             Put #2, , ttt(i)<br>        Next i<br>     close #2<p>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?<p>Thank in advance<br><p><a name="followups">Follow Ups:</a><br><ul><!--insert: 1911--><!--top: 1989--><li><a href="1989.html"><b>观念不正确</b></a> 小吴 <i>19:44:34 2/17/98</i>(<!--responses: 1989-->0)<ul><!--insert: 1989--></ul><!--end: 1989--></ul><!--end: 1911--><br><HR><p></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?