请在下面的代码中帮助我。它抛出错误:Android 套接字:缓冲区为空。你能告诉我有什么问题吗?
try {
socket = new Socket("217.16.10.21", 1991);
out = new PrintStream(socket.getOutputStream(), true);
out.write(("285|SIP|0200|**4536780670138355*000000*1000***1309181650****000094*130918165044**1408***0918*****901301654144**300*************000000023834****00400013*65432100400013 ******P920035595*952*******************************************************************************").getBytes());
byte[] buffer = null;
int is=socket.getInputStream().read(buffer, 0, 1024);
socket.setSoTimeout(500);
String message=new String(buffer, 0, is);
//in = new BufferedReader(new InputStreamReader(is), 8192);
out.close();
//String message=in.readLine();
textaff.setText(message);
in.close();
//socket.close();
Toast.makeText(getApplicationContext(), " "+message, 2000).show();
} catch (UnknownHostException e) {
Toast.makeText(getApplicationContext(), "erreur"+e.getMessage(), Toast.LENGTH_LONG).show();
e.printStackTrace();
} catch (IOException e) {
Toast.makeText(getApplicationContext(), "erreur 2 "+e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
e.printStackTrace();
}