public boolean sendImage(FrameType type,String filename,File imageFile){
        try{
            if(sendString(FrameType.ImageFileName,filename)){
                Log.Print(LogType.Log, "Sending file: "+filename);
                if(writeMessageHeader(type.val, (int)imageFile.length())){
                    FileInputStream is = new FileInputStream(imageFile);
                    blueGUI.setProgress(0);
                    byte[] buf = new byte[512];
                    int read;
                    while((read=is.read(buf))!=-1){
                        outPort.write(buf,0,read);
                        outPort.flush();
                        System.out.print(".");
                        System.out.flush();
                        //blueGUI.setProgress((100/(int)imageFile.length())*i);
                    }
                    blueGUI.setProgress(100);
                Log.Print(LogType.Log, "Sent"+filename);
                    return true;
                }
            }
        } catch (IOException e){
            e.printStackTrace();
        }
        return false;
    }