private void connect(String ip, int port){ 
  
     
     int size;
     byte[] w = new byte[10240];
     txtReceive="";
     try{
      socket = new Socket(ip,port);
      if(socket != null) {
       in = socket.getInputStream();
       out = socket.getOutputStream();
       PrintWriter pw = new PrintWriter( new OutputStreamWriter( out ) );
       
       pw.println(LOGIN_ID);
       pw.flush() ;
      
       while(socket != null && socket.isConnected()){
        size = in.read(w);
        if(size<=0)continue;
        txtReceive = new String(w,0,size,"UTF-8");
        handler.post(new Runnable(){
         public void run() {
          if(cntup > 1)
          {
           iy = iy - 5;
           cntup = 0;
          }
          if(cntdown > 1)
          {
           iy = iy + 5;
           cntdown = 0;
          }
          //Toast.makeText(getApplicationContext(),txtReceive, 
                   //        Toast.LENGTH_SHORT).show(); 
            
          //  Toast t = Toast.makeText(getApplicationContext(), return_msg, Toast.LENGTH_SHORT);
          /*/주석처리
          if(txtReceive.equals("AndroidClient:upup"))
          { 
           iy = iy + 20;
           
          }
          else if(txtReceive.equals("AndroidClient:downdown"))
          {
           iy = iy - 20;
          } */
          lblReceive.setText( lblReceive.getText()+txtReceive );
         }
        });
       }
      }
     } catch (Exception ex) {Log.e("socket",ex.toString());}
    }

 

주제는 센서를 이용하여 서버로 값을 전달하여 그값을 다시 클라이언트에게 보내서 켄버스로 그린 이미지 x  y 값을 + - 하여 이동하는

것을 보여주는 것입니다.

 

위부분은 클라이언트 코드 커넥트 부분인데 우선 클라이언트가 일정한 피치 롤 값이 되면 그것을 문자로바꿔 서버로 전송해주어서

 

서버는 다시 클라이언트에게 어떤 메세지를 보내주게 되는데 그메세지값을 가지고 조건을 걸어 x y 값을 조절하여 이미지를 움직여야되는데 도통 이미지가 움직이질 않네요..도와주세요 ㅜ