DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 1 of 1

Thread: Xml and Network stream issues

  1. #1
    Join Date
    Feb 2006

    Xml and Network stream issues


    I have posted this on a couple of forums and needing replies from any angle possible as I am really stressed out and have been working on this for almost 4 days solid and over 13 hours per day.

    I am trying to serialize an object, or collection of objects via network stream.

    Client is a smartphone and Server is a PC. both running .NET Framework 2.0.

    The problem is, that 99% of the time, the client does not recieve the xml serialized string fully from the Server.

    I can see the Server has sent the string in full, by serializing to a file and reading the file myself.

    When sent, the client recieves only partial of the string, causing an invalid document therefore it won't deserialize.

    No idea where the problem is, been trying to debug the code and came to the point where the port listening class/method is the one where somewhere in there has the problem. But unsure where.

    //method which listens to a port on a new thread.
    theData = this.theNetworkStream.Read(theIncomingDataBuffer, 0, theIncomingDataBuffer.Length);
    while (this.theNetworkStream.DataAvailable)
      theData += this.theNetworkStream.Read(theIncomingDataBuffer, theData, theIncomingDataBuffer.Length - theData);
    if (theData > 0)
       this.theIncomingDataManager.DoAnalyzeData(System.Text.Encoding.UTF8.GetString(theIncomingDataBuffer, 0, theData)); 

    only sometimes will the client recieve the full proper xml serialized string but most times it won't. This is even without modifying any objects properties or values or anything from the Server before serializing.

    Just to confirm, Server is sending it in full (serializer.Serialize(theNetworkStream, collectionOfObjects))

    If it didnt, we would get an exception there and then. But for sure, it is serializing correctly.

    The same thing would also happen when doing it FROM the client TO the server. so its the same thing, same issue, just from different ends.

    Any help, advice, tips or hints are much appreciated.

    Please help, I need to see if I can get some asprin now!
    Last edited by firehawk; 05-08-2006 at 03:44 PM.

Similar Threads

  1. Writing and Reading a XML Stream
    By Bryan in forum XML
    Replies: 2
    Last Post: 05-08-2006, 05:58 PM
  2. XML Pre-Sales, Tech Support/Systems Engineer
    By stylusstudio in forum Careers
    Replies: 0
    Last Post: 05-03-2006, 12:28 AM
  3. Access XP export to XML document
    By Simon in forum XML
    Replies: 2
    Last Post: 10-24-2002, 06:20 AM
  4. XML and relational databases
    By Colin Webster in forum XML
    Replies: 8
    Last Post: 09-09-2001, 03:40 PM
  5. XML Startkabel News
    By XML Startkabel in forum XML
    Replies: 0
    Last Post: 04-05-2001, 06:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center