问题描述
- java socket 收不到客户端消息
-
直接用字节留能收到
InputStream is = socket.getInputStream();转成字符六就收不到消息了
br = new BufferedReader(new InputStreamReader(socket.getInputStream()));请问这是怎么回事.在线等...谢谢 .
对方发过来的是16进制的数据.我用InputStream处理不了,必须转成BufferedReader,但是转完就收不到数据了.
解决方案
改成inputStream=socket.getInputStream();
fferedInputStream bufferInput=new BufferedInputStream(inputStream);
byte[] bty=new byte[100];
int len=bufferInput.read(bty);
str=new String(bty,0,len);
试试
时间: 2024-10-29 06:58:23