Page 573 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 573

//  This is  a  blocking call  and  will  only return on  a

                                 //  successful connection  or an  exception

                                 mmSocket.connect();    //  서버  연결


                            } catch (IOException  e) {

                                 //  Close  the  socket

                                 try  {

                                       mmSocket.close();

                                 } catch (IOException  e2)  {


                                       Log.e(TAG,  "unable  to  close()  "  +  mSocketType  +

                                                 " socket  during connection  failure",  e2);

                                 }

                                            //  connectionFailed();  //연결실패

                                 return;


                            }

                            //  Reset  the  ConnectThread  because  we're  done

                            synchronized  (BluetoothTestService.this)  {

                                 mConnectThread  =  null;

                            }


                            //  Start  the  connected thread

                            connected(mmSocket, mmDevice,  mSocketType);

                        //  정상  연결되면  실제  데이터  송수신  담당  객체를  생성하여  통신하게됨(서버와  동일)

                       }

                       public void  cancel() {


                            try {

                                 mmSocket.close();

                            } catch (IOException  e) {




                                                         -  566  -
   568   569   570   571   572   573   574   575   576   577   578