String result ="";
try {
inputStream =socket.getInputStream();
DataInputStream input =new DataInputStream(inputStream);
int count =0;
while (count ==0) {
count = input.available();
}
byte[] b =new byte[count];
int len = input.read(b);
result =new String(b,0, len);
parseString(result);//解析得到的字符串
}catch (Exception e) {
e.printStackTrace();
}finally {
disConnSocket();//断开连接
}
网友评论