public void body()
    {
        // find out ids for entities that are not part of simulation network
        // topology, such as GIS, GridSimShutdown and GridStatistics
        int gisID = GridSim.getGridInfoServiceEntityId();
        int statID = GridSim.getGridStatisticsEntityId();
        int shutdownID = GridSim.getGridSimShutdownEntityId();

        // start generating some junk packets or background traffic
        startBackgroundTraffic();

        // Process incoming events
        while ( Sim_system.running() )
        {
            Sim_event ev = new Sim_event();
            super.sim_get_next(ev);     // get the next event in the queue

            // if the simulation finishes then exit the loop
            if (ev.get_tag() == GridSimTags.END_OF_SIMULATION) {
                break;
            }

            //System.out.println(super.get_name() + ".body(): ev.get_tag() is " + ev.get_tag());
            //System.out.println(super.get_name() + ".body(): ev.get_src() is " + ev.get_src());

            // handle different types of incoming events
            switch ( ev.get_tag() )
            {
                case GridSimTags.SEND_PACKET:
                    sendPacket();
                    break;

                // submit ping() request
                case GridSimTags.INFOPKT_SUBMIT:
                    sendInfoPacket(ev);
                    break;

                // replying ping() request from another entity
                case GridSimTags.INFOPKT_RETURN:
                    returnInfoPacket(ev);
                    break;

                // activate background traffic
                case GridSimTags.JUNK_PKT:
                    generateBackgroundTraffic();
                    break;

                default:
                    defaultSend(ev, gisID, statID, shutdownID);
                    break;
            }
        }
    }