제가 HttpURLConnection을 통해 xml내용을 스마트TV로 보내고 있습니다.
그런데 스마트폰의 화면을 터치하여 움직이면 그 움직임의 좌표를 스마트TV로 보내서 마우스 포인터를
움직이는 것을 하고 있습니다. 움직임을 보내다보니 짧은 시간에 많은 양의 xml을 보내게 되는데
이 때 문제가 발생하는 것이 자꾸 멈춘다는 것입니다. 스마트폰이 멈춰서 버튼을 눌러도 반응을 안하는 상태가 됩니다.
그러다가 일정 시간이 지나면 다시 움직이고 하는데 멈추는 시간이 매우 불규칙합니다. 잘될때는 잘되가 한번 멈춤기
시작 하면 너무 빈번하게 멈춤니다. 그리고 멈추는 시간도 5~30초까지 제마음대로 멈췄다가 움직입니다. ...
이것을 어떻게 해결해야 하나요?! 빈도가 너무 잦아서 문제입니다.
무선네트워크로 연결하여 사용중인데... 스마트TV 쪽의 문제인지 아니면 스마트폰 쪽의 문제인지 좀 알려주세요..ㅜ
==================================== 스마트폰 HttpURLConnection 소스 ==================================
이 소스는 핸들러를 통해 동작하고 있습니다.
private void httpPostData()
{
try{
String target_ipandport = "http://"+SmartControl.SamrtTV_ipandport+
launch_service_path;
Log.d("Mouse_move", "target_ipandport = "+target_ipandport);
URL mURL = new URL(target_ipandport);
HttpURLConnection connection = (HttpURLConnection)mURL.openConnection();
connection.setDoOutput(true);
connection.setInstanceFollowRedirects(false);
connection.setChunkedStreamingMode(0);
connection.setRequestMethod("POST");
connection.setConnectTimeout(1000);
connection.setUseCaches(false);
//connection.setReadTimeout(200);
StringBuffer buffer = new StringBuffer();
buffer.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n");
buffer.append("<envelope>\r\n");
buffer.append("<api type=\"command\">\r\n");
buffer.append("<name>HandleTouchMove</name>\r\n");
buffer.append("<x>"+SmartControl.Mouse_x+"</x>\r\n");
buffer.append("<y>"+SmartControl.Mouse_y+"</y>\r\n");
buffer.append("</api>\r\n");
buffer.append("</envelope>\r\n\r\n");
Log.d("Mouse_move", buffer.toString());
connection.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
connection.setRequestProperty("Content-Length", Integer.toString(buffer.length()));
connection.setRequestProperty("Connection", "Keep-Alive");
connection.setRequestProperty("User-Agent", "UDAP/2.0");
OutputStream os = connection.getOutputStream();
os.write(buffer.toString().getBytes("UTF-8"));
os.flush();
if(HttpURLConnection.HTTP_OK == connection.getResponseCode())
{
Log.d("Mouse_move","Success!!!!");
}else
{
Log.d("Mouse_move","FAIL!!!!!");
}
os.close();
connection.disconnect();
}
catch(IOException e)
{
e.printStackTrace();
}
}