public NativeDatagramPacket toDatagramPacket(InetAddress destinationAddress) { return new NativeDatagramPacket(m_packetData.duplicate(), destinationAddress, 0); }
public NativeDatagramPacket toDatagramPacket(InetAddress destinationAddress) { return new NativeDatagramPacket(m_packetData.duplicate(), destinationAddress, 0); }
public NativeDatagramPacket toDatagramPacket(InetAddress destinationAddress) { return new NativeDatagramPacket(m_packetData.duplicate(), destinationAddress, 0); }
public NativeDatagramPacket toDatagramPacket(InetAddress destinationAddress) { // compute and set the ICMP Header checksum setChecksum(); return new NativeDatagramPacket(m_packetData.duplicate(), destinationAddress, 0); }
public NativeDatagramPacket toDatagramPacket(InetAddress destinationAddress) { // compute and set the ICMP Header checksum setChecksum(); return new NativeDatagramPacket(m_packetData.duplicate(), destinationAddress, 0); }
public NativeDatagramPacket toDatagramPacket(InetAddress destinationAddress) { // compute and set the ICMP Header checksum setChecksum(); return new NativeDatagramPacket(m_packetData.duplicate(), destinationAddress, 0); }
public void dump() throws Exception { NativeDatagramSocket m_pingSocket = NativeDatagramSocket.create(NativeDatagramSocket.PF_INET6, NativeDatagramSocket.IPPROTO_ICMPV6, 1234); if (Platform.isWindows()) { ICMPv6EchoPacket packet = new ICMPv6EchoPacket(64); packet.setCode(0); packet.setType(Type.EchoRequest); packet.getContentBuffer().putLong(System.nanoTime()); packet.getContentBuffer().putLong(System.nanoTime()); m_pingSocket.send(packet.toDatagramPacket(InetAddress.getByName("::1"))); } try { NativeDatagramPacket datagram = new NativeDatagramPacket(65535); while (true) { m_pingSocket.receive(datagram); System.err.println(datagram); } } catch(Throwable e) { e.printStackTrace(); } }
public void dump() throws Exception { NativeDatagramSocket m_pingSocket = NativeDatagramSocket.create(NativeDatagramSocket.PF_INET6, NativeDatagramSocket.IPPROTO_ICMPV6, 1234); if (Platform.isWindows()) { ICMPv6EchoPacket packet = new ICMPv6EchoPacket(64); packet.setCode(0); packet.setType(Type.EchoRequest); packet.getContentBuffer().putLong(System.nanoTime()); packet.getContentBuffer().putLong(System.nanoTime()); m_pingSocket.send(packet.toDatagramPacket(InetAddress.getByName("::1"))); } try { NativeDatagramPacket datagram = new NativeDatagramPacket(65535); while (true) { m_pingSocket.receive(datagram); System.err.println(datagram); } } catch(Throwable e) { e.printStackTrace(); } }
public void dump() throws Exception { NativeDatagramSocket m_pingSocket = NativeDatagramSocket.create(NativeDatagramSocket.PF_INET6, Platform.isMac() ? NativeDatagramSocket.SOCK_DGRAM : NativeDatagramSocket.SOCK_RAW, NativeDatagramSocket.IPPROTO_ICMPV6); if (Platform.isWindows()) { ICMPv6EchoPacket packet = new ICMPv6EchoPacket(64); packet.setCode(0); packet.setType(Type.EchoRequest); packet.getContentBuffer().putLong(System.nanoTime()); packet.getContentBuffer().putLong(System.nanoTime()); m_pingSocket.send(packet.toDatagramPacket(InetAddress.getByName("::1"))); } try { NativeDatagramPacket datagram = new NativeDatagramPacket(65535); while (true) { m_pingSocket.receive(datagram); System.err.println(datagram); } } catch(Throwable e) { e.printStackTrace(); } }
public void run() { try { NativeDatagramPacket datagram = new NativeDatagramPacket(65535); while (!isFinished()) { getPingSocket().receive(datagram); long received = System.nanoTime(); ICMPv6Packet icmpPacket = new ICMPv6Packet(getIPPayload(datagram)); V6PingReply echoReply = icmpPacket.getType() == Type.EchoReply ? new V6PingReply(icmpPacket, received) : null; if (echoReply != null && echoReply.isValid()) { // 64 bytes from 127.0.0.1: icmp_seq=0 time=0.069 ms System.out.printf("%d bytes from [%s]: tid=%d icmp_seq=%d time=%.3f ms\n", echoReply.getPacketLength(), datagram.getAddress().getHostAddress(), echoReply.getIdentifier(), echoReply.getSequenceNumber(), echoReply.elapsedTime(TimeUnit.MILLISECONDS) ); for (PingReplyListener listener : getListeners()) { listener.onPingReply(datagram.getAddress(), echoReply); } } } } catch(Throwable e) { m_throwable.set(e); e.printStackTrace(); } }
@Override public void run() { Logging.putPrefix("icmp"); try { final int pingerId = getPingerId(); while (!isFinished()) { final NativeDatagramPacket datagram = new NativeDatagramPacket(65535); getPingSocket().receive(datagram); final long received = System.nanoTime(); final ICMPv6Packet icmpPacket = new ICMPv6Packet(getIPPayload(datagram)); final V6PingReply echoReply = icmpPacket.getType() == Type.EchoReply ? new V6PingReply(icmpPacket, received) : null; if (echoReply != null && echoReply.getIdentifier() == pingerId && echoReply.isValid()) { notifyPingListeners(datagram.getAddress(), echoReply); } } } catch(final Throwable t) { setThrowable(t); LOG.debug("Error caught while processing ping packets: {}", t.getMessage(), t); } }
@Override public void run() { try { final NativeDatagramPacket datagram = new NativeDatagramPacket(65535); while (!isFinished()) { getPingSocket().receive(datagram); final long received = System.nanoTime(); final ICMPv6Packet icmpPacket = new ICMPv6Packet(getIPPayload(datagram)); final V6PingReply echoReply = icmpPacket.getType() == Type.EchoReply ? new V6PingReply(icmpPacket, received) : null; if (echoReply != null && echoReply.isValid()) { // 64 bytes from 127.0.0.1: icmp_seq=0 time=0.069 ms System.out.printf("%d bytes from [%s]: tid=%d icmp_seq=%d time=%.3f ms%n", echoReply.getPacketLength(), datagram.getAddress().getHostAddress(), echoReply.getIdentifier(), echoReply.getSequenceNumber(), echoReply.elapsedTime(TimeUnit.MILLISECONDS) ); for (PingReplyListener listener : getListeners()) { listener.onPingReply(datagram.getAddress(), echoReply); } } } } catch(final Throwable e) { m_throwable.set(e); e.printStackTrace(); } }
@Override public void run() { try { final NativeDatagramPacket datagram = new NativeDatagramPacket(65535); while (!isFinished()) { getPingSocket().receive(datagram); final long received = System.nanoTime(); final ICMPPacket icmpPacket = new ICMPPacket(getIPPayload(datagram)); final V4PingReply echoReply = icmpPacket.getType() == Type.EchoReply ? new V4PingReply(icmpPacket, received) : null; if (echoReply != null && echoReply.isValid()) { // 64 bytes from 127.0.0.1: icmp_seq=0 time=0.069 ms System.out.printf("%d bytes from %s: tid=%d icmp_seq=%d time=%.3f ms%n", echoReply.getPacketLength(), datagram.getAddress().getHostAddress(), echoReply.getIdentifier(), echoReply.getSequenceNumber(), echoReply.elapsedTime(TimeUnit.MILLISECONDS) ); for (PingReplyListener listener : getListeners()) { listener.onPingReply(datagram.getAddress(), echoReply); } } } } catch(final Throwable e) { m_throwable.set(e); e.printStackTrace(); } }
public void run() { try { NativeDatagramPacket datagram = new NativeDatagramPacket(65535); while (!isFinished()) { getPingSocket().receive(datagram); long received = System.nanoTime(); ICMPPacket icmpPacket = new ICMPPacket(getIPPayload(datagram)); V4PingReply echoReply = icmpPacket.getType() == Type.EchoReply ? new V4PingReply(icmpPacket, received) : null; if (echoReply != null && echoReply.isValid()) { // 64 bytes from 127.0.0.1: icmp_seq=0 time=0.069 ms System.out.printf("%d bytes from %s: tid=%d icmp_seq=%d time=%.3f ms\n", echoReply.getPacketLength(), datagram.getAddress().getHostAddress(), echoReply.getIdentifier(), echoReply.getSequenceNumber(), echoReply.elapsedTime(TimeUnit.MILLISECONDS) ); for (PingReplyListener listener : getListeners()) { listener.onPingReply(datagram.getAddress(), echoReply); } } } } catch(Throwable e) { m_throwable.set(e); e.printStackTrace(); } }
@Override public void run() { Logging.putPrefix("icmp"); try { final int pingerId = getPingerId(); while (!isFinished()) { final NativeDatagramPacket datagram = new NativeDatagramPacket(65535); getPingSocket().receive(datagram); final long received = System.nanoTime(); final ICMPPacket icmpPacket = new ICMPPacket(getIPPayload(datagram)); final V4PingReply echoReply = icmpPacket.getType() == Type.EchoReply ? new V4PingReply(icmpPacket, received) : null; if (echoReply != null && echoReply.getIdentifier() == pingerId && echoReply.isValid()) { notifyPingListeners(datagram.getAddress(), echoReply); } } } catch(final Throwable e) { setThrowable(e); LOG.debug("Error caught while processing ping packets: {}", e.getMessage(), e); } }
@Override public void run() { try { final NativeDatagramPacket datagram = new NativeDatagramPacket(65535); while (!isFinished()) { getPingSocket().receive(datagram); final long received = System.nanoTime(); final ICMPPacket icmpPacket = new ICMPPacket(getIPPayload(datagram)); final V4PingReply echoReply = icmpPacket.getType() == Type.EchoReply ? new V4PingReply(icmpPacket, received) : null; if (echoReply != null && echoReply.isValid()) { // 64 bytes from 127.0.0.1: icmp_seq=0 time=0.069 ms System.out.printf("%d bytes from %s: tid=%d icmp_seq=%d time=%.3f ms%n", echoReply.getPacketLength(), datagram.getAddress().getHostAddress(), echoReply.getIdentifier(), echoReply.getSequenceNumber(), echoReply.elapsedTime(TimeUnit.MILLISECONDS) ); for (PingReplyListener listener : getListeners()) { listener.onPingReply(datagram.getAddress(), echoReply); } } } } catch(final Throwable e) { m_throwable.set(e); e.printStackTrace(); } }
@Override public void run() { try { final NativeDatagramPacket datagram = new NativeDatagramPacket(65535); while (!isFinished()) { getPingSocket().receive(datagram); final long received = System.nanoTime(); final ICMPv6Packet icmpPacket = new ICMPv6Packet(getIPPayload(datagram)); final V6PingReply echoReply = icmpPacket.getType() == Type.EchoReply ? new V6PingReply(icmpPacket, received) : null; if (echoReply != null && echoReply.isValid()) { // 64 bytes from 127.0.0.1: icmp_seq=0 time=0.069 ms System.out.printf("%d bytes from [%s]: tid=%d icmp_seq=%d time=%.3f ms%n", echoReply.getPacketLength(), datagram.getAddress().getHostAddress(), echoReply.getIdentifier(), echoReply.getSequenceNumber(), echoReply.elapsedTime(TimeUnit.MILLISECONDS) ); for (PingReplyListener listener : getListeners()) { listener.onPingReply(datagram.getAddress(), echoReply); } } } } catch(final Throwable e) { m_throwable.set(e); e.printStackTrace(); } }