public static void sendFile() throws IOException {
        sendString("Sent");
        BufferedOutputStream bos = new BufferedOutputStream(socket.getOutputStream());
        if(bos != null) {
            File toSend = new File(pathToFile);
            sendString(toSend.length() + "");
            byte[] bytes = new byte[(int) toSend.length()];
            FileInputStream fis = null;
            try {
                fis = new FileInputStream(toSend);
            }catch(FileNotFoundException ex) {
                warn("File not found!", false);
                return;
            }
            BufferedInputStream bis = new BufferedInputStream(fis);
            bis.read(bytes, 0, bytes.length);
            bos.write(bytes, 0, bytes.length);
            bos.flush();
        }
    }