Well, I have a tcp port (.NET2) that is being read. It receives raw XML. So the nominal input stream looks something like this:-
I can deserialise each of the objects which I may receive - I know what the potential set of them is.
My problem is that a read on the port will simply return whatever is there. This can of course be a partial message or potentially more than one message. Any suggestions as to how I might be able to extract the strings representing the serialised objects. Stuffed if I can figure out a way.
Whenever I've done it I've tended to use a length at the beginning and a sentinel at the end so it's easy to extract the packets, sadly I don't have this option I'm not in any sort of control of the sender.
Code:
<?xml version="1.0" encoding="utf-8"?>
<SomeObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<AProperty>46982</AProperty>
</SomeObject>
<?xml version="1.0" encoding="utf-8"?>
<SomeOtherObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<AProperty>46982</AProperty>
</SomeOtherObject>
My problem is that a read on the port will simply return whatever is there. This can of course be a partial message or potentially more than one message. Any suggestions as to how I might be able to extract the strings representing the serialised objects. Stuffed if I can figure out a way.
Whenever I've done it I've tended to use a length at the beginning and a sentinel at the end so it's easy to extract the packets, sadly I don't have this option I'm not in any sort of control of the sender.


Comment