jpcap写包时的EXCEPTION_ACCESS_VIOLATION



我正在创建一个小实用程序,用于使用jpcap将各种数据有效负载写入pcap转储文件。对于每个有效负载,我创建一个如"通过网络接口发送数据包"示例中所述的数据包,并发送它:

            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);

无论我尝试的数据有效负载是多少,writePacket都会导致以下结果(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
# 

问题:

  1. 是否将新构建的数据包写入jpcap支持的转储?有一个基于捕获的数据包编写转储并通过网络接口发送新构造的数据包的示例。
  2. 解决错误的步骤是什么

同样的代码对我来说工作得很好。我也试过了,没有出现错误

相关内容

  • 没有找到相关文章

最新更新