Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NetworkStream doesnt receive all the data in time...

Status
Not open for further replies.

phunugus

Programmer
Dec 26, 2002
21
0
0
US
First off, this code works fine in debug mode, but not in run mode. This loop is only getting some of the data. After NetworkStream.Read is called, there is no more data in the buffer and DataAvailable turns to False, but the server still has data to send to me, it just hasnt sent it to me yet.
i used:

While stream.DataAvailable
size = stream.Read(current, 0, current.Length)
Debug.Write(size & vbCrLf)
ReDim Preserve current(size - 1)
ReDim Preserve all(all.Length + size - 1)
Array.Copy(current, 0, all, all.Length - size, current.Length)
ReDim current(8191)
End While

any help would be appreciated, thanx

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top