안드로이드 개발 질문/답변
(글 수 45,052)
안녕하세요..지금까지는 애뮬로만 연습해오다가 디자이어로 해보는 중인데요..
전에도 이와 비슷한 문제로 글 올려서 해결했는데..
이번 문제도 아무리 찾아도 모르겠네여..
아래와 같이 웹에서 코드를 읽어오는 소스인데..애물에서는 정상적으로 소스를 읽어와서 화면에 뿌려주는데
단말기에 하니까 host is unresolved 라면서 www.nate.com:80 라는 IoException이 나네요..
INTERNET Permmision도 주고 했는데 이유가 뭘까요?
public class test1 extends Activity {
TextView tv;
URL url;
URLConnection connection;
InputStream is;
InputStreamReader isr;
BufferedReader br;
String strXML = "";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv = (TextView) findViewById(R.id.tv);
try{
url = new URL("http://www.nate.com");
connection = url.openConnection();
is = connection.getInputStream();
isr = new InputStreamReader(is,"EUC-KR");
br = new BufferedReader(isr);
String buf = null;
while(true){
buf = br.readLine();
if(buf == null){
break;
}else{
strXML += buf + "\n";
}
}
tv.setText(strXML);
}catch(MalformedURLException mue){
Log.e("Error1", mue.getMessage());
}catch(IOException ioe){
Log.e("Error2", ioe.getMessage());
}
}
}
구글에서 하루에 300회인가만의 요청을 받고 그 이후가 되면 ddms공격으로 인식해서 접근을 차단시킨다는 말이 있는데
이제는 한시간에 한 열댓번만 해도 그런게 나오는 듯 하네요