I am trying for packet sniffer, I am able to extract info from TCP, UDP, ICMP packets, but I want to get QOS field from IP packet , I tried for this but not getting any proper way! Any ideas?
Or you could use tshark, which is the console line version of wireshark. In case you saved your capture file as foo.pcap you could run
tshark -r foo.pcap -T fields -e ip.dsfield
This will output a line for each packet printing the dscp value of the ip header. The TOS value is accessible as well. If you want extract other values take a look at the wireshark display filter reference: http://www.wireshark.org/docs/dfref/ You can add any filter found in the list as an -e option and get a list with all your -e option fields. The separator might be changed with the -E option, e.g. -E separator=',' for a comma separated list.
If you want to write your own application, I would recommend using SharpPcap (http://sourceforge.net/projects/sharppcap/) library. This library gets updates frequently. If you need to stick to java, please pay attention to compare your results to wireshark. There are two different jpcap libraries and I had made bad experience with one of them some years ago. Unfortunately, I don't remember which one was getting mixed up when using it on 32bit and 64bit systems. But maybe both got fixed in the mean time.