Page 603 - 3-3
P. 603

flag = socketIn.read(); //  서버에서 값을 수신 받음
                                   if (flag == 0) { //  서버에서 0  값을 수신 받을 경우
                                       connect.close(); //  소켓통신 종료
                                       Toast.makeText(getBaseContext(), " 로그인 실패",
              Toast.LENGTH_SHORT).show();
                                   }
                                   else if (flag == 1) { //  서버에서 1  값을 수신 받을 경우
                                       //String str = null;
                                       //byte[] buff = new byte[64]; // byte 단위로 보내주기위해 변수생성
                                       //int read = 0;


                                       //read = socketIn.read(buff, 0 , 64); //  한글이름 값을 받아옴
                                       //str = new String(buff);// str  변수에 저장
                                       name = "  통신 3-1";
                                       Toast.makeText(getBaseContext(), " 로그인 되었습니다",
              Toast.LENGTH_SHORT).show();
                                       Intent intent = new Intent(getApplicationContext(), Class_Main.class);
              // MenuActivity 로 가는 intent 생성
                                       intent.putExtra("name", name); // "name" 의 str 값을 넣어서 다음
              인탠트로 넘김
                                       intent.putExtra("IP",IP); // IP 를 Key 값 IP 로 넘김
                                       intent.putExtra("WebIP",WebIP); // WebIP 를 Key 값 WebIP 로 넘김
                                       intent.putExtra("PORT",PORT) // PORT 를 Key  값 PORT  로 넘김;


               //                                다음 intent 에서는 getStringExtra  를 통해 값을 받아오면됨
                                       //                                */
                                       connect.close(); //  소켓통신 종료
                                       startActivity(intent); //  화면전환
                                   }


                               } catch (IOException e) { //  서버에 연결할수 없을경우
                                   Toast.makeText(getBaseContext(), " 연결할 수 없습니다",
              Toast.LENGTH_SHORT).show();
                               }


                           }
                       });


                       back.setOnClickListener(new View.OnClickListener() {
                           @Override
                           public void onClick(View v) { //  종료 버튼
                               Toast.makeText(getBaseContext(), " 종료되었습니다",
              Toast.LENGTH_SHORT).show();
                               finish();
               // 액티비티 종료


                                                          - 603 -
   598   599   600   601   602   603   604   605   606   607   608