public void run() {

        /////////////////////////////////////////////////////
        // For ease of I/O (since we haven't yet discussed
        // binary packet data), convert the distance vector into
        // a String so it can be read using a Scanner:
        /////////////////////////////////////////////////////
        String dvs = convert(from.getDv());

        /////////////////////////////////////////////////////
        // Make ten attempts to send the packet, then give up. The ten attempts
        // are separated by a one-second wait. This is simply to give the user
        // enough time to manually start up all the routers.
        /////////////////////////////////////////////////////
        Socket sock = null;
        boolean done = false;
        int tries = 0;

        while (!done && tries < 10) {
            try {
                Thread.sleep(1000); // long wait due to manual startup

                sock = new Socket(to.getAddr(), to.getPort());
                DataOutputStream out = new DataOutputStream(sock.getOutputStream());
                out.writeBytes(dvs);
                sock.close();
                done = true;
            } catch (Exception e) {
                tries++;
                if (tries >= 10)
                    System.out.println(from.getId() + " giving up sending to " +
                            to.getId());
            }
        }
    }