Fixed the permission problem. Same solution can be applied for client
(nested Thread/Runnable in AsyncTask).