diff --git a/BookFloatingServer.java b/BookFloatingServer.java index 75bca96..1390d6f 100644 --- a/BookFloatingServer.java +++ b/BookFloatingServer.java @@ -26,13 +26,17 @@ class Handle implements Runnable pw=new PrintWriter(os); while(true) - { - String str=br.readLine(); - if(str==null) - { + { + byte[] buf = new byte[1024]; + int len =is.read(buf); + if(len < 0){ break; } + String str = new String(buf,0,len); + + System.out.println("String is: "+str); + Gson gson=new Gson(); AppJsonData data=null; try @@ -41,6 +45,7 @@ class Handle implements Runnable } catch(Exception e) { + e.printStackTrace(); System.out.println("Receive a incorrect json string."); continue; } @@ -57,6 +62,7 @@ class Handle implements Runnable } catch(Exception e) { + e.printStackTrace(); System.out.println("Incorrect Register Data"); break; } @@ -76,6 +82,7 @@ class Handle implements Runnable } catch(Exception e) { + e.printStackTrace(); System.out.println("Incorrect Login Data"); break; }