private synchronized void submitToLink(Sim_event ev)
    {
        //Object[] packet = new Object[2];
        IO_data data = (IO_data) ev.get_data();
        Object obj = data.getData();
        long size = data.getByteSize();
        int tag = ev.get_tag();
        int destId = data.getDestID();
        int netServiceType = data.getNetServiceLevel();

        // we need to packetsize the data, all packets are sent with size MTU.
        // only the last packet contains the data, the receiver should
        // throw away all other packets
        int MTU = link_.getMTU();
        int numPackets = (int) Math.ceil(size / (MTU * 1.0));
        int glID = 9999;
        int fileID = 9999;
        //firstLastPacketsGridlet packGl = new firstLastPacketsGridlet();
        FnbEndToEndPath conn = null;
        try{

            if (obj instanceof Gridlet)
            {
                glID = ((Gridlet) obj).getGridletID();
                // Here we will keep the packets belonging to each gridlet

                //packGl.setFirstPacketID(pktID_); // the first packet of this gridlet
                //packGl.setGridletID(glID);

                conn = new FnbEndToEndPath(destId, super.get_id(),
                                           netServiceType, numPackets, glID, false);

            }
            else if (obj instanceof DataGridlet)  // For the datagrid extension
            {
                glID = ((DataGridlet) obj).getGridletID();

                // Here we will keep the packets belonging to each gridlet

               //packGl.setFirstPacketID(pktID_); // the first packet of this gridlet
               //packGl.setGridletID(glID);

               conn = new FnbEndToEndPath(destId, super.get_id(),
                                          netServiceType, numPackets, glID, false);

            }
            else if (obj instanceof Object[]) // For the datagrid extension (File)
            {


                String fileName = null;

                try
                {
                    // Add master (from user to resource)

                    fileName = ((File) ((Object[]) obj)[0]).getName();

                }catch(Exception e)
                {

                     fileName = ((String) ((Object[]) obj)[0]);

                }


                /*
                int length = ((Object[])obj).length;
                if (length == 2)
                {
                    // Add master (from user to resource)

                    fileName = ((File) ((Object[]) obj)[0]).getName();

                }// if (length == 2)
                else if (length == 3)
                {
                     // Add master (from res to user)
                     fileName = ((String) ((Object[]) obj)[0]);

                }*/

                glID = checkFilename(fileName); // get a id for the file
                //packGl.setFirstPacketID(pktID_);    // the first packet of this file
                //packGl.setFileID(glID);  // the name of the file

                conn = new FnbEndToEndPath(destId, super.get_id(),
                                           netServiceType, numPackets, glID, true);
                                           //GridSimTags.FNB_PKT_CONTAINS_FILE);

                //System.out.println(super.get_name() + ": fileName: " + fileName);



            }
            else
            {
                conn = new FnbEndToEndPath(destId, super.get_id(),
                                           netServiceType, numPackets);
            }

        }catch(Exception e)
        {
            System.out.println(super.get_name() + ":ERROR.");
            e.printStackTrace();


        }
        // make dummy packets with null data

        convertIntoPacket(MTU, numPackets, tag, conn);

        // last packet contains the actual data
        FnbNetPacket np = null;

        np = new FnbNetPacket(obj, pktID_, size - MTU * (numPackets - 1), tag,
                           conn.getSrc());

        np.setPath(conn);


        /*np = new FnbNetPacket(obj, pktID_, size - MTU * (numPackets - 1), tag,
                           super.get_id(),
                           destId, netServiceType, numPackets, numPackets);*/

        /*if ((obj instanceof Gridlet) || (obj instanceof DataGridlet) ||
            (obj instanceof Object[]))
        {
            packGl.setLastPacketID(pktID_); // the last packet of this gridlet

            packetsGridletsList_.add(packGl); // put this firstLastPacketsGridlet entity into the list

            //System.out.println(">>>>>>>>>> "+super.get_name() +
            //                   ": submitting entity: " + glID + " .(First, last): (" +
            //                   packGl.getFirst() + ", " + packGl.getLast() + ")");

        }*/

        enque(np, GridSimTags.SCHEDULE_NOW);

        pktID_++; // increments packet ID
    }