I am working on an Android Application in which I got stuck in an issue. The problem is that, "When I run this method mentioned below in code, I am getting an error of socket Exception ((Permission denied) i.e, java.net.SocketException: socket failed:). I tried many time to resolve this issue, but still getting experiencing this problem. I know this is an community where I am seeking some solution. Please help me for resolving my query. Here is code please check and reply me asap.
Bash
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 ();
}
Alles anzeigen