private void initSocket(String host, String port) throws IOException { // check the validity of the host name if (host == null || host.isEmpty()) { throw new IllegalArgumentException("host == null || host.isEmpty()"); } // check the validity of the port number int p = 0; try { p = Integer.parseInt(port); } catch (NumberFormatException e) { throw new IllegalArgumentException("Illegal port argument"); } if (p <= 0) { throw new IllegalArgumentException("Illegal port argument"); } // establish the network connection try { this.socket = new Socket(host, p); } catch (IOException e) { getErrorManager().error("Failed to establish the network connection", e, ErrorManager.OPEN_FAILURE); throw e; } super.internalSetOutputStream(new BufferedOutputStream(this.socket.getOutputStream())); }
/** * Closes this handler. The network connection to the host is also closed. */ @Override public void close() { try { super.close(); if (this.socket != null) { this.socket.close(); this.socket = null; } } catch (Exception e) { getErrorManager().error("Exception occurred when closing the socket handler", e, ErrorManager.CLOSE_FAILURE); } }
@Override public void close() { try { super.close(); if (this.socket != null) { this.socket.close(); this.socket = null; } } catch (Exception e) { getErrorManager().error("Exception occurred when closing the socket handler", e, ErrorManager.CLOSE_FAILURE); } }
private void initSocket(String host, String port) throws IOException { // check the validity of the host name if (host == null || host.isEmpty()) { throw new IllegalArgumentException("host == null || host.isEmpty()"); } // check the validity of the port number int p = 0; try { p = Integer.parseInt(port); } catch (NumberFormatException e) { throw new IllegalArgumentException("Illegal port argument"); } if (p <= 0) { throw new IllegalArgumentException("Illegal port argument"); } // establish the network connection try { this.socket = new Socket(host, p); } catch (IOException e) { getErrorManager().error("Failed to establish the network connection", e, ErrorManager.OPEN_FAILURE); throw e; } super.internalSetOutputStream(new BufferedOutputStream(this.socket.getOutputStream())); }
private void initSocket(String host, String port) throws IOException { // check the validity of the host name if (host == null || host.isEmpty()) throw new IllegalArgumentException("host == null || host.isEmpty()"); // check the validity of the port number int p = 0; try { p = Integer.parseInt(port); } catch (NumberFormatException e) { throw new IllegalArgumentException("Illegal port argument"); } if (p <= 0) { throw new IllegalArgumentException("Illegal port argument"); } // establish the network connection try { this.socket = new Socket(host, p); } catch (IOException e) { getErrorManager().error("Failed to establish the network connection", e, ErrorManager.OPEN_FAILURE); throw e; } super.internalSetOutputStream(new BufferedOutputStream(this.socket.getOutputStream())); }
private void initSocket(String host, String port) throws IOException { // check the validity of the host name if (host == null || host.isEmpty()) { throw new IllegalArgumentException("host == null || host.isEmpty()"); } // check the validity of the port number int p = 0; try { p = Integer.parseInt(port); } catch (NumberFormatException e) { throw new IllegalArgumentException("Illegal port argument"); } if (p <= 0) { throw new IllegalArgumentException("Illegal port argument"); } // establish the network connection try { this.socket = new Socket(host, p); } catch (IOException e) { getErrorManager().error("Failed to establish the network connection", e, ErrorManager.OPEN_FAILURE); throw e; } super.internalSetOutputStream(new BufferedOutputStream(this.socket.getOutputStream())); }
private void initSocket(String host, String port) throws IOException { // check the validity of the host name if (host == null || host.isEmpty()) { throw new IllegalArgumentException("host == null || host.isEmpty()"); } // check the validity of the port number int p = 0; try { p = Integer.parseInt(port); } catch (NumberFormatException e) { throw new IllegalArgumentException("Illegal port argument"); } if (p <= 0) { throw new IllegalArgumentException("Illegal port argument"); } // establish the network connection try { this.socket = new Socket(host, p); } catch (IOException e) { getErrorManager().error("Failed to establish the network connection", e, ErrorManager.OPEN_FAILURE); throw e; } super.internalSetOutputStream(new BufferedOutputStream(this.socket.getOutputStream())); }
/** * Closes this handler. The network connection to the host is also closed. */ @Override public void close() { try { super.close(); if (this.socket != null) { this.socket.close(); this.socket = null; } } catch (Exception e) { getErrorManager().error("Exception occurred when closing the socket handler", e, ErrorManager.CLOSE_FAILURE); } }
/** * Closes this handler. The network connection to the host is also closed. */ @Override public void close() { try { super.close(); if (this.socket != null) { this.socket.close(); this.socket = null; } } catch (Exception e) { getErrorManager().error("Exception occurred when closing the socket handler", e, ErrorManager.CLOSE_FAILURE); } }
/** * Closes this handler. The network connection to the host is also closed. */ @Override public void close() { try { super.close(); if (this.socket != null) { this.socket.close(); this.socket = null; } } catch (Exception e) { getErrorManager().error("Exception occurred when closing the socket handler", e, ErrorManager.CLOSE_FAILURE); } }
/** * Closes this handler. The network connection to the host is also closed. */ @Override public void close() { try { super.close(); if (this.socket != null) { this.socket.close(); this.socket = null; } } catch (Exception e) { getErrorManager().error("Exception occurred when closing the socket handler", e, ErrorManager.CLOSE_FAILURE); } }
private void initSocket(String host, String port) throws IOException { // check the validity of the host name if (host == null || host.isEmpty()) { throw new IllegalArgumentException("host == null || host.isEmpty()"); } // check the validity of the port number int p = 0; try { p = Integer.parseInt(port); } catch (NumberFormatException e) { throw new IllegalArgumentException("Illegal port argument"); } if (p <= 0) { throw new IllegalArgumentException("Illegal port argument"); } // establish the network connection try { this.socket = new Socket(host, p); } catch (IOException e) { getErrorManager().error("Failed to establish the network connection", e, ErrorManager.OPEN_FAILURE); throw e; } super.internalSetOutputStream(new BufferedOutputStream(this.socket.getOutputStream())); }
/** * Closes this handler. The network connection to the host is also closed. */ @Override public void close() { try { super.close(); if (this.socket != null) { this.socket.close(); this.socket = null; } } catch (Exception e) { getErrorManager().error("Exception occurred when closing the socket handler", e, ErrorManager.CLOSE_FAILURE); } }
private void initSocket(String host, String port) throws IOException { // check the validity of the host name if (host == null || host.isEmpty()) { throw new IllegalArgumentException("host == null || host.isEmpty()"); } // check the validity of the port number int p = 0; try { p = Integer.parseInt(port); } catch (NumberFormatException e) { throw new IllegalArgumentException("Illegal port argument"); } if (p <= 0) { throw new IllegalArgumentException("Illegal port argument"); } // establish the network connection try { this.socket = new Socket(host, p); } catch (IOException e) { getErrorManager().error("Failed to establish the network connection", e, ErrorManager.OPEN_FAILURE); throw e; } super.internalSetOutputStream(new BufferedOutputStream(this.socket.getOutputStream())); }
private void initSocket(String host, String port) throws IOException { // check the validity of the host name if (host == null || host.isEmpty()) { throw new IllegalArgumentException("host == null || host.isEmpty()"); } // check the validity of the port number int p = 0; try { p = Integer.parseInt(port); } catch (NumberFormatException e) { throw new IllegalArgumentException("Illegal port argument"); } if (p <= 0) { throw new IllegalArgumentException("Illegal port argument"); } // establish the network connection try { this.socket = new Socket(host, p); } catch (IOException e) { getErrorManager().error("Failed to establish the network connection", e, ErrorManager.OPEN_FAILURE); throw e; } super.internalSetOutputStream(new BufferedOutputStream(this.socket.getOutputStream())); }
/** * Closes this handler. The network connection to the host is also closed. */ @Override public void close() { try { super.close(); if (this.socket != null) { this.socket.close(); this.socket = null; } } catch (Exception e) { getErrorManager().error("Exception occurred when closing the socket handler", e, ErrorManager.CLOSE_FAILURE); } }