Beispiel #1
0
        internal static void ICMPHandler(byte[] packetData)
        {
            //ICMP Handler called
            ICMPPacket icmp_packet = new ICMPPacket(packetData);

            switch (icmp_packet.ICMP_Type)
            {
            case 0:
                recvd_reply = new ICMPEchoReply(packetData);
                //Received ICMP Echo reply from " + recvd_reply.SourceIP.ToString()
                break;

            case 8:
                ICMPEchoRequest request = new ICMPEchoRequest(packetData);
                //Received " + request.ToString()
                ICMPEchoReply reply = new ICMPEchoReply(request);
                //Sending ICMP Echo reply to " + reply.DestinationIP.ToString()
                OutgoingBuffer.AddPacket(reply);
                NetworkStack.Update();
                break;
            }
        }