I'm creating a small utility for writing various data payloads to a pcap dump file using jpcap. For each payload I create a packet as described in the "Send packets through a network interface" example and send it:
byte[] data = new byte[messageLengthRead];
long secs; // initialized to a legit value based on other code
TCPPacket p = new TCPPacket(12, 34, 56, 78, false, false, false, false,
true, true, true, true, 10, 10);
p.setIPv4Parameter(0, false, false, false, 0, false, false, false, 0,
1010101, 100, IPPacket.IPPROTO_TCP, InetAddress
.getByName("www.microsoft.com"), InetAddress
.getByName("www.google.com"));
p.data = data;
p.len = data.length;
p.sec = secs;
EthernetPacket ether = new EthernetPacket();
ether.frametype = EthernetPacket.ETHERTYPE_IP;
ether.src_mac = new byte[] { (byte) 0, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5 };
ether.dst_mac = new byte[] { (byte) 0, (byte) 6, (byte) 7, (byte) 8, (byte) 9, (byte) 10 };
p.datalink = ether;
writer.writePacket(p);
The writePacket results in the following regardless of the data payload that I try (null, "", " "):
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d7cfc0e, pid=6748, tid=4260
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_22-b03 mixed mode)
# Problematic frame:
# V [jvm.dll+0x8fc0e]
#
# An error report file with more information is saved as hs_err_pid6748.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
Questions:
- Is writing a newly constructed packet to a dump supported by jpcap? There is an example of writing a dump based on captured packets and sending a newly constructed packet through a network interface.
- What are they steps to trouble shooting the error.
Same code is working fine for me. I have also tried it and no error is coming up.