Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IOException
- IOException
- try {
- Socket socket = new Socket(Lector.IP_DISPLAY, Lector.PUERTO_DISPLAY);
- if (socket == null) {
- envio(cadena);
- return;
- }
- socket.setSoTimeout(2000);
- PrintStream out = new PrintStream(socket.getOutputStream());
- out.println(cadena);
- if (out != null) {
- out.close();
- }
- if (socket != null) {
- socket.close();
- }
- out = null;
- socket = null;
- } catch (ConnectException cx) {
- // Aquí tratas la excepción, por ejemplo volver a intentar conectar.
- } catch (IOException ex) {
- LOGGER.log(Level.SEVERE, null, ex);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement