修复Socket的BUG
This commit is contained in:
parent
482beb3df3
commit
fbf38130d7
|
@ -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;
|
||||
}
|
||||
|
|
Reference in New Issue
Block a user