//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private void sendICMPEchoResponse(pspsharp.network.protocols.NetPacket packet, pspsharp.network.protocols.EtherFrame frame, pspsharp.network.protocols.IPv4 ipv4, pspsharp.network.protocols.ICMP icmp) throws java.io.EOFException private void sendICMPEchoResponse(NetPacket packet, EtherFrame frame, IPv4 ipv4, ICMP icmp) { bool reachable = false; try { InetAddress inetAddress = InetAddress.getByAddress(ipv4.destinationIPAddress); // Timeout after 1 second reachable = inetAddress.isReachable(null, ipv4.timeToLive, 1000); } catch (UnknownHostException) { } catch (IOException) { } if (reachable) { // See https://en.wikipedia.org/wiki/Ping_(networking_utility) EtherFrame answerFrame = new EtherFrame(frame); answerFrame.swapSourceAndDestination(); IPv4 answerIPv4 = new IPv4(ipv4); answerIPv4.swapSourceAndDestination(); answerIPv4.timeToLive--; // When a packet arrives at a router, the router decreases the TTL FieldInfo. ICMP answerIcmp = new ICMP(icmp); answerIcmp.type = ICMP.ICMP_CONTROL_ECHO_REPLY; answerIcmp.computeChecksum(); answerIPv4.totalLength = answerIPv4.sizeOf() + answerIcmp.sizeOf(); answerIPv4.computeChecksum(); // Write the different headers in sequence NetPacket answerPacket = new NetPacket(BUFFER_SIZE); answerFrame.write(answerPacket); answerIPv4.write(answerPacket); answerIcmp.write(answerPacket); sendPacket(answerPacket); } }