Пример #1
0
 /** Release the reserved port. */
 private void releasePort() {
   if (temporaryConnection != null) {
     try {
       temporaryConnection.close();
     } catch (IOException e) {
       temporaryConnection = null;
     }
   }
 }
Пример #2
0
 /**
  * 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;
     }
   }
 }