get sequence number using winpcap
I am working on a project and I have a minor task of retrieving packet sequence numbers.Recently, I came to know about winpcap and I want to know whther I 开发者_C百科can retrieve sequence numbers from TCP headers.Please help
winpcap is a library for sniffing packets. WinDump is a command-line utility (similar to tcpdump) that will display packets and sequence numbers (use -S to get absolute sequence numbers). WireShark is a GUI that will do it all for you.
You can retrieve the sequence number from the packet. WinPcap, after capturing a packet passes it to you as a byte sequence of type char*. You will need to use pointers and structures to get to the TCP Header(Refer to the WinPcap documentation) once you have a tcp header structure pointing at the start of the tcp header of the byte array, you can access the sequence number as a member of the structure DON'T forget to use ntohl() to convert the sequence number to host bit format.
精彩评论