/** Release the reserved port. */ private void releasePort() { if (temporaryConnection != null) { try { temporaryConnection.close(); } catch (IOException e) { temporaryConnection = null; } } }
/** * Reserve a port. * * @param port Port to reserve */ private void reservePort(int port) { if (temporaryConnection == null) { try { temporaryConnection = NetworkFactory.getFactory().createDatagramConnection(); temporaryConnection.open(port); } catch (IOException e) { temporaryConnection = null; } } }