hhhH?++/ '#
hhhH馃
hhhH?
代码
- Java code
public void doService(){ System.out.println("server doService now!"); while(server!=null){ Socket socket=null; InputStream in=null; OutputStream out=null; try { socket = server.accept(); in=getBufferedInputStream(socket); byte[] tmp=new byte[1024]; int re=-1; while((re=in.read(tmp))!=-1){ System.out.println(new String(tmp,0,re)); } out=getBufferedOutputStream(socket); out = getBufferedOutputStream(socket); out.write("i have received your message!".getBytes()); out.write(new byte[] { 0x0d, 0x0a }); out.flush(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ try{ in.close(); out.close(); socket.close(); }catch (Exception e) { // TODO: handle exception } } } }
------解决方案--------------------
你没转16进制字符串当然乱了