Code example for ServerSocket

0
    boolean start() throws IOException { 
        if (mThread != null) {
            return false; 
        } 
 
        mServer = new ServerSocket(mPort, VIEW_SERVER_MAX_CONNECTIONS, InetAddress.getLocalHost());
        mThread = new Thread(this, "Remote View Server [port=" + mPort + "]");
        mThreadPool = Executors.newFixedThreadPool(VIEW_SERVER_MAX_CONNECTIONS);
        mThread.start();
 
        return true; 
    } 
 
    /** 
     * Stops the server. 
     * 
     * @return True if the server was stopped, false if an error occured or if the 
     *         server wasn't started. 
     * 
     * @see #start() 
     * @see #isRunning()