private boolean transmit() {
        FileInputStream fis = null;
        try {
            byte[] data = new byte[1024];
            fis = new FileInputStream(file);
            byte[] buf = new byte[512];
            int i = 1;
            while (fis.read(buf) != -1) {
                if (!transmitPacket(buf, i)) {
                    return false;
                }
                i++;
            }
            if (fis.available() >= 0) {
                data = new byte[fis.available()];
                fis.read(data);
                if (!transmitPacket(data, i)) {
                    return false;
                }
                fis.close();
                return true;
            }
        } catch (FileNotFoundException ex) {
            System.out.println("Fichier non trouvé");
            fireErrorOccured("Fichier non trouvé");
        } catch (IOException ex) {
            System.out.println("Echec lecture du fichier");
            fireErrorOccured("Echec lecture du fichier");
        }
        return false;
    }