I have an appliction which is receiving inbound xml which it processes and writes to a database.

I am having a problem when receiving a large stream. In winsock api I would wait until the whole message was received and parse the streams together to form the file. When I try that here, I do not get the whole file.

Here is an example of the code.
VB Code:
  1. Do
  2.                     Dim InBuff(200000) As Byte
  3.                     Client.GetStream().Read(InBuff, 0, InBuff.Length)
  4.                     txtLog.Text = txtLog.Text & vbCrLf & "[" & Now & "] >Processing incoming request."
  5.                     Application.DoEvents()
  6.                     temp = temp & System.Text.Encoding.Default.GetString(InBuff)
  7.                     temp = Trim(temp)
  8.  Loop Until Client.GetStream.DataAvailable = False


Sometimes I get the whole file on the first run. Could I get some he