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);
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 04:44 PM.
Last Post: 05-08-2006, 06:58 PM
By stylusstudio in forum Careers
Last Post: 05-03-2006, 01:28 AM
Last Post: 10-24-2002, 07:20 AM
By Colin Webster in forum XML
Last Post: 09-09-2001, 04:40 PM
By XML Startkabel in forum XML
Last Post: 04-05-2001, 07:56 AM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center