public UnicastThread(int port) throws IOException {
  super("unicast request");
  setDaemon(true);
  if (port == 0) {
    try {
      listen=new ServerSocket(Constants.getDiscoveryPort());
    }
 catch (    IOException e) {
      logger.log(Levels.HANDLED,"failed to bind to default port",e);
    }
  }
  if (listen == null) {
    listen=new ServerSocket(port);
  }
  this.port=listen.getLocalPort();
}

public UnicastThread ( int port ) throws IOException { super ( "unicast request" ) ; setDaemon ( true ) ; if ( port == 0 ) { try { listen = new ServerSocket ( Constants . getDiscoveryPort ( ) ) ; } catch ( IOException e ) { logger . log ( Levels . HANDLED , "failed to bind to default port" , e ) ; } } if ( listen == null ) { listen = new ServerSocket ( port ) ; } this . port = listen . getLocalPort ( ) ; }
create a daemon thread . set up the socket now rather than in run , so that we get any exception up front .
