VB.NET: Problem with too large XML data
Say when i click on "A" button, my program will receive the large XML data for "A" from the server...
1) However, i will only receive one section of data....
2) Then when i continue to click on "B" button, it will not receive "B" data
instead it will continue to receive the rest of "A" data...
My coding for receiving the data....
Code:
Dim tcpC As New TcpClient
Public Function receive() As String
Dim ascii As Encoding = Encoding.ASCII
Dim networkStream As NetworkStream
Try
networkStream = tcpC.GetStream()
Dim bytes(tcpC.ReceiveBufferSize) As Byte
networkStream.Read(bytes, 0, CInt(tcpC.ReceiveBufferSize))
Dim ret As String = ascii.GetString(bytes)
Return ret
Catch
End Try
End Function
How to solve the problem of getting large data...
Thanks
Re: VB.NET: Problem with too large XML data
Most probably, that has to do with the TCP/IP packet size (that can vary a lot) - when you receive, you don't get all the data in one packet. You should wait for the complete stream of bytes, maybe a software data length header could help you.
Cheers,
NTG