소켓 서버와 클라이언트를 사용하여 이미지를 보내고 있습니다. 그것은 "App not responding"이 비트 맵을 변환하는 beacuse가 UiThread에서 작성되었다고 생각합니다. 그래서 그것을 변경하려고했지만 여전히 "이 응용 프로그램이 응답하지 않습니다"라는 메시지가 나타납니다. 내가 큰 imaes + 500kb를 보낼 때 그것은 일어나고있다. 클라이언트에 대한전송 데이터 중에 앱이 응답하지 않습니다.
public class SocketServerThread extends Thread {
static final int SocketServerPORT = 8080;
int count = 0;
@Override
public void run() {
try {
serverSocket = new ServerSocket(SocketServerPORT);
while (true) {
Socket socket = serverSocket.accept();
count++;
// Here where i am doing my code i think is not doing in UiThread..
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run()
{
// Firstly i was doing my code here...
}
});
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
내 코드 :
public class MyClientTask extends AsyncTask<Void, Void, Void> {
MyClientTask(String addr, int port){
dstAddress = addr;
dstPort = port;
}
@Override
protected Void doInBackground(Void... arg0) {
Socket socket = null;
try
{
//I am sending my image here...
}
}
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
response = "UnknownHostException: " + e.toString();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
response = "IOException: " + e.toString();
}finally{
if(socket != null){
try {
socket.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return null;
}
@Override
protected void onPostExecute(Void result)
{
super.onPostExecute(result);
}
}
그래서 내 도와주세요
여기 서버에 대한 내 코드입니다. 왜 아직도 대화에 응답하지 않는 이유는 무엇입니까?
귀하의 logcat을 게시하십시오. –