Results 1 to 2 of 2

Thread: VB.NET: Problem with too large XML data

  1. #1

    Thread Starter
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230

    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

  2. #2
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,449

    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
    "Feel the force...read the source..."
    Utilities: POPFileDebugViewProcess ExplorerWiresharkKeePassUltraVNCPic2Ascii
    .Net tools & open source: DotNetNukelog4NetCLRProfiler
    My open source projects: Thales SimulatorEFT CalculatorSystem Info ReporterVSS2SVNIBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width