Ranjeet Kumar
- Forum posts: 15
Sep 4, 2015, 8:06:24 AM via Website
Sep 4, 2015 8:06:24 AM via Website
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 android developer forum community where I am seeking some solution. Please help me for resolving my query. Here is code please check and reply me asap.
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();
}
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.