Reputation: 1496
I am recieving XML-Datas from server which is like:
<SystemAsync timestamp="1289734897" status="stopped" time="0"/>
or :
<SystemAsync timestamp="1289734897" status="stopped" time="0">
<AntTable antstatus="ready" active="1"/>
</SystemAsync>
There is no problem parsing the xml. But server can send the xml-data in 2 splitted parts
1.part of xml-data
<SystemAsync timestamp="1289734897" status="stopped" time="0">
<AntTable antstatus="ready" active="1"/>
2.part of xml data:
</SystemAsync>
How can I check, if the xml data is not ended, so I can wait for 2. part.?
This is an Server/Client Socket System.
My server recieves XML-Datas from the rootserver, and sends the xml-data to all clients.
Thank you!
Upvotes: 1
Views: 326
Reputation: 62504
I believe in this particular case question could be more generalized to a problem of entire XML document validation. Considering that sending a data in multiple chunks is a valid case - it would be great if communion protocol you're using would provide you somethik like EndOfStream marker/message to indicate that all data is sent. Many messaging systems provides built in support of feature like Message Index/Sequence Number, perhaps protocol you're suing support it so you can enable it whilst initializing a connection, take a look documentation if such is provided.
Otherwise you've to perform check each time you've received next one chunk.
Useful links:
Upvotes: 0
Reputation: 161773
The server needs to delimit the message it's sending. It basically needs to tell you when it's done.
Basing your code on "when do I stop getting an exception" is not a good idea. What if you never stop getting an exception?
Upvotes: 1