@Override public void onPingReply(final InetAddress address, final EchoPacket packet) { m_callback.handleReply(new JnaPingReply(address, packet)); }
void processPackets(ReplyHandler<Jni6PingResponse> callback) { while (true) { try { DatagramPacket packet = m_socket.receive(); Jni6PingResponse reply = Jni6IcmpMessenger.createPingResponse(packet); if (reply != null && reply.getIdentifier() == m_pingerId) { callback.handleReply(reply); } } catch (IOException e) { LOG.error("I/O Error occurred reading from ICMP Socket", e); } catch (IllegalArgumentException e) { // this is not an EchoReply so ignore it } catch (IndexOutOfBoundsException e) { // this packet is not a valid EchoReply ignore it } catch (Throwable e) { LOG.error("Unexpected Exception processing reply packet!", e); } } }
void processPackets(ReplyHandler<Jni6PingResponse> callback) { while (true) { try { DatagramPacket packet = m_socket.receive(); Jni6PingResponse reply = Jni6IcmpMessenger.createPingResponse(packet); if (reply != null && reply.getIdentifier() == m_pingerId) { callback.handleReply(reply); } } catch (IOException e) { LOG.error("I/O Error occurred reading from ICMP Socket", e); } catch (IllegalArgumentException e) { // this is not an EchoReply so ignore it } catch (IndexOutOfBoundsException e) { // this packet is not a valid EchoReply ignore it } catch (Throwable e) { LOG.error("Unexpected Exception processing reply packet!", e); } } }
void processPackets(ReplyHandler<JniPingResponse> callback) { final int pingerId = m_pingerId; while (true) { try { DatagramPacket packet = m_socket.receive(); JniPingResponse reply = JniIcmpMessenger.createPingResponse(packet); if (reply.isEchoReply() && reply.getIdentifier() == pingerId) { // Remove this so we don't send a lot of time in this method when we should be processing packets // LogUtils.debugf(this, "Found an echo packet addr = %s, port = %d, length = %d, created reply %s", packet.getAddress(), packet.getPort(), packet.getLength(), reply); callback.handleReply(reply); } } catch (IOException e) { LOG.error("I/O Error occurred reading from ICMP Socket", e); } catch (IllegalArgumentException e) { // this is not an EchoReply so ignore it } catch (IndexOutOfBoundsException e) { // this packet is not a valid EchoReply ignore it } catch (Throwable e) { LOG.error("Unexpected Exception processing reply packet!", e); } } }