Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Socket Exception in android

    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 540
    Answer it

    When I run this method I get an error of socket Exception.
    (Permission denied) i.e,java.net.SocketException: socket failed:

    Can you please me to find its solution.

    public void run() {
        // TODO Auto-generated method stub
        URL url = null;
    
    try {
        url = new URL("http url");
    }
    catch (MalformedURLException me) {
        // TODO Auto-generated catch block
        me.printStackTrace();
    }
    try {
        URLConnection uelCon = url.openConnection();
        InputStreamReader inputStreamReader = new InputStreamReader(BufferedInputStream(myconn.getInputStream()));
        BufferedReader buffer = new BufferedReader(inputStreamReader);
        String traverse;
        StringBuilder builder = new StringBuilder();
        while ((traverse=buffer.readLine()) != null)
        {
            builder.append(traverse);
    
        }
    
    }
    catch (IOException ioe) {
        // TODO Auto-generated catch block
        ioe.printStackTrace();
    }
    
    super.run();
    }
    
    

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: