Page 797 - 3-2
P. 797

}


                    /*
                    public void onclick_back(View v) {


                     */


                    public void onclicked_connect(View v){
                        Thread worker = new Thread() {
                            public void run() {
                                try {
                                    socket = new Socket("192.168.0.200", 3322);
                                    socket_out = new PrintWriter(socket.getOutputStream(), true);
                                    socket_in             =             new              BufferedReader(new
            InputStreamReader(socket.getInputStream()));
                                } catch (IOException e) {
                                    e.printStackTrace();
                                }
                                try {
                                    while (true) {
                                       output.post(new Runnable() {
                                           public void run() {
                                               output.setText(data);
                                           }
                                       });
                                    }
                                } catch (Exception e) {
                                }
                            }
                        };
                        worker.start();
                    }




                @Override
                protected void onStop() {
                    // TODO Auto-generated method stub
                    super.onStop();
                    try {
                        socket.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }


                                                         - 797 -
   792   793   794   795   796   797   798   799   800   801   802