这是我的asyntask类,我尝试连接到服务器并将纬度和经度发送给它 .

public class MyClientTask extends AsyncTask<Void, Void, Void> {
   MyClientTask() {}

    @Override
    protected Void doInBackground(Void... arg0) {
        Socket socket = null;
        try {
             socket = new Socket("107.170.21.173", 8000);
             OutputStream out = socket.getOutputStream();
             out.write("latitute".getBytes());// sending the lat to server
             out.write("longitute".getBytes()); // sending the long to server
             InputStream inputStream = socket.getInputStream();
             int output=inputStream.read();
        }
        catch (UnknownHostException e)    
             e.printStackTrace();
        response = "UnknownHostException: " + e.toString();
}

但我无法读取输入流即服务器的响应 . 我读出了TCP / IP连接,但无法在我的代码中实现它 .