Code example for ServerSocket

Methods: setReuseAddress

0
    private ServerSocket createSvrSockIt() throws IOException     {
         
        InetAddress ip;        
        ip= isEmpty(_host) ? InetAddress.getLocalHost() : InetAddress.getByName(_host) ;
         
        ServerSocket soc= new ServerSocket(_port, _backlog, ip); 
        ServerSocket s=null;
        try         { 
            soc.setReuseAddress(true);
            s=soc;
            soc=null;
        } 
        finally { 
            NetUte.close(soc);
        } 
 
        tlog().debug("TCP: opened server socket: {} on host: {}" , _port , _host);
        return s;
    } 
             
    /* (non-Javadoc)