Code example for BufferedWriter

Methods: close, flush, write

0
     */ 
    public void run() { 
        try { 
            mServer = new ServerSocket(mPort, VIEW_SERVER_MAX_CONNECTIONS, InetAddress.getLocalHost());
        } catch (Exception e) {
            Log.w(LOG_TAG, "Starting ServerSocket error: ", e);
        } 
 
        while (mServer != null && Thread.currentThread() == mThread) {
            // Any uncaught exception will crash the system process 
            try { 
                Socket client = mServer.accept();
                if (mThreadPool != null) {
                    mThreadPool.submit(new ViewServerWorker(client));
                } else { 
                    try { 
                        client.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    } 
                }