private void buttonSendActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_buttonSendActionPerformed ByteFile byteFile = null; Socket sock = null; try { byteFile = new ByteFile(file); sock = new Socket(ipEdit.getText(), Integer.parseInt(portEdit.getText())); } catch (ConnectException ex) { JOptionPane.showMessageDialog(this, "Conexión rechazada"); log.log(Level.SEVERE, null, ex); } catch (UnknownHostException ex) { JOptionPane.showMessageDialog( this, "Host desconocido. Asegurate que la dirección es correcta"); log.log(Level.SEVERE, null, ex); } catch (IOException ex) { JOptionPane.showMessageDialog(this, ex.toString()); log.log(Level.SEVERE, null, ex); } catch (NullPointerException ex) { JOptionPane.showMessageDialog(this, "Selecciona fichero"); log.log(Level.SEVERE, null, ex); } catch (NumberFormatException ex) { JOptionPane.showMessageDialog( this, "Error recuperando números. Asegurate de que la dirección IP y el puerto no contienen letras"); log.log(Level.SEVERE, null, ex); } Connection con = new TCPConnection(new ConnectionID(byteFile.fileName()), sock); try { con.send(Crypto.encrypt(byteFile)); } catch (ConnectionsException ex) { log.log(Level.SEVERE, null, ex); JOptionPane.showMessageDialog(this, ex.toString()); } } // GEN-LAST:event_buttonSendActionPerformed