监听端口
public Zithread(Socket clientSocket){Socket socket = new Socket();
try{
socket = clientSocket;
socket.setSoTimeout(10000);
InputStreamReader isReader = new InputStreamReader(socket.getInputStream());
OutputStream outputStream = new DataOutputStream(socket.getOutputStream());
BufferedReader reader;
reader = new BufferedReader(isReader);
byte[] b = new byte[3000];
int x;
StringBuilder sBuilder = new StringBuilder();
while((x=is.read(b)) != -1){
sBuilder.append(new String(b, 0, x, "utf-8"));
}
String infos = sBuilder.toString();
Map<String, Object> returnMap = this.dealWithInfos(infos);
byte[] dateBytes = null;
dateBytes = JsonUtil.buildJsonMessage(returnMap, "utf-8");
outputStream.write(dateBytes);
outputStream.flush();
is.flush();
outputStream.close();
is.close();
}catch (IOException e){
}catch (Exception e){
}finally{
try{
socket.close();
}catch (IOException e){
}
}
}
这是我写的监听端口监听后的处理流程,监听到推送报文后进行处理可以接收到对方推送的报文,但是处理后返回报文对方却接收不到,我也用过dateoutputstream意外的方法写输出流,但是对方都接收不到,请问各位大大这是什么原因,本地没有报错,对方也没有报错,只是报的接收超时,对方可以接受其它系统的返回报文