主线程异常上的网络仍未由单独的线程解决

时间:2016-11-27 15:08:48

标签: java multithreading

new Thread(new Runnable(){
            @Override
            public void run() {
                try {
                    // Your implementation
                                clientSocket = new Socket("192.168.0.112", 9874);
        outToServer = new DataOutputStream(clientSocket.getOutputStream());
        inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
                    //ClientReceiveThread clientReceiveThread = new ClientReceiveThread(clientSocket,textview);
                }
                catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        }).start();

即使我试图在一个单独的线程上执行网络任务,为什么它仍然给我网络主线程异常

0 个答案:

没有答案