From: Periya.Data <per...@gm...> - 2011-09-01 21:57:15
|
Hi, I have a bytebuffer of size 2048 bytes. Its initial bytes have some custom data (upto 70th byte). From 71st byte, the DNS messages are there. I think I know the length of the DNS message (I am not yet sure about this). How do I get one message at a time from the bytebuffer? I am doing something like this: byte[] dns_msg_buf= new byte[1024]; bb.get(dns_msg_buf, 71, caplen); // bb is a byte buffer with custom data and dns msgs. Caplen is the len. Message dns_msg = new Message(dns_msg_buf); System.out.println("Message size: " + dns_msg.numBytes()); dns_msg.numBytes => seems to be returning the size of the header only = which is 12 bytes. Is there a way to find the total length of the message = hdr + 4 message sections? Thanks, PD. |