views:

48

answers:

1

I have devices. Each one sends data to (server IP-address) over a particular port in a random time. Because it's an alarm device and it’s possible that more than one device fired in the same time.
The data is in XML Format.

Now I already got a small windows application which listen for the data But I got a few problems

1 problem is that the application is sniffing the packets. Mean that I can get the data in the TCP packets ....that’s mean that I will get the xml divided in the packets And not in sequence (order by time)...that’s make it so hard to read the xml data Or just arrange it and read from it. I need to read that data coming from the device and save it in xml format.

Any idea how to do that. I saw some other Questions here and I tried all this answers but nothing talking about reading the xml file. I’m using the same code as in this article

http://www.codeproject.com/KB/IP/CSNetworkSniffer.aspx

Thanks for all your help

+1  A: 

You are sniffing the RAW packets that are passing through the network driver. At this low level it will be up to you to process and reconstruct the messages by analysing the packets and using things like the TCP seq, the ack/nak messages etc.

Here is the wikipedia article on the TCP protocol that might help you get started before delving into the deeper side of things. http://en.wikipedia.org/wiki/Transmission_Control_Protocol

And of course the most critical source the RFC. http://tools.ietf.org/html/rfc793

i assume you are sniffing the data because you have some other application that is actually acting as a server and listening for the data. If now you really should just write an application that listens on the TCP port and reads the data from there. This way the TCP protocol will ensure that you receive all the data in the right order etc. To get started with this, you could use the TcpListener class, or you go use the lower level Socket classes

Chris Taylor