OmegaMan
Maks wrote: |
Is there a better way to do the job than read bytes from the port to an array and then trick them into XML document. I will appreciate design ideas or the snippet. | |
Trick Like making the bytes jump and roll over <g>
The job of reading data from any type of socket is to pull it off the port as fast as possible so there is no loss of data. Those packets are handed off to a manager that combines and coverts them for consumption by other layers in the application. If those bytes are meant as Xml, then they will have to be converted to ascii and loaded into an XmlDocument, there is no way around that.
I suggest you have a multi-threaded app, where the thread monitoring the socket only pulls data off of the socket and places it raw onto a queue to be pulled by another thread, whose sole job it is to convert it to an appropriate format that can be consumed by the business layer of the application.
Don't make the mistake of trying to do combination and reading of the port, otherwise one risks dropping packets.