Results 21 to 22 of 22
- 10-08-2010, 02:03 PM #21
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Then you'd need to know what the packets actually contain. It's quite possible they are broken up, with the first byte meaning something, the second couple meaning something else, then the next couple being used to say how long the message is, then the rest being the message with a stop byte at the end.
- 10-11-2010, 05:05 PM #22
Member
- Join Date
- Oct 2010
- Posts
- 16
- Rep Power
- 0
Just a follow up post really.
Thanks for everyones help. I did finally get it working :)
I used:
//tempPacket = the variable used to hold the raw data straight off the NIC
//packetString = the byte array used to hold the converted "data" from tempPacket
//payload = the data as a string - final var for this stage.
Packet tempPacket = captor.getPacket();
if (tempPacket != null) {
byte[] packetString = tempPacket.data;
String payload = new String(packetString);
That prints out every packet is the exact format I was expecting. I then used my IF statement to only produce packets with MSG in them - All MSN message packets have this and some a few more unique characteristics.
Thanks again
Ben
Similar Threads
-
null values
By jabo in forum New To JavaReplies: 3Last Post: 03-31-2010, 03:44 PM -
Printing values from object in Array?
By thesinter in forum New To JavaReplies: 3Last Post: 01-20-2010, 05:19 AM -
How to get null values stored in array
By Ms.Ranjan in forum New To JavaReplies: 4Last Post: 05-21-2009, 10:29 PM -
Printing default Swing values
By Java Tip in forum Java TipReplies: 0Last Post: 03-12-2008, 11:09 AM -
how to read memory addresses
By fred in forum New To JavaReplies: 1Last Post: 07-24-2007, 01:59 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks