From c6c75af649359781e792cb841b44fb06631f08ad Mon Sep 17 00:00:00 2001 From: Myth Yang Date: Fri, 23 Aug 2013 15:08:35 +0800 Subject: oops --- client/Socket-demo/Transam.java | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'client/Socket-demo/Transam.java') diff --git a/client/Socket-demo/Transam.java b/client/Socket-demo/Transam.java index 6f0fb44..b5e2381 100644 --- a/client/Socket-demo/Transam.java +++ b/client/Socket-demo/Transam.java @@ -12,6 +12,7 @@ import android.os.Message; public class Transam implements Runnable { public Timer timer; public boolean flag = true; + public boolean reqlog = false; public int cnt = 4; public int port; public String ip; @@ -19,6 +20,16 @@ public class Transam implements Runnable { Myrequest req; Myrespond res; Controller core; + Login log; + + + Transam(String i,int p,Myrequest r,Login l){ + port = p; + ip = i; + req = r; + log = l; + reqlog = true; + } Transam(String i,int p,Myrequest r,Controller c){ port = p; @@ -43,8 +54,19 @@ public class Transam implements Runnable { public void run() { try{ SocketClient client = new SocketClient(ip,port); - res = client.sendMsg(req); + res = client.sendMsg(req); + if(!reqlog){ core.recieveInfo(res); + } + else{ + if((Integer) res.contain.get(2)==0){ + int t = (Integer) res.contain.get(1); + log.success(t); + } + else{ + log.failed(); + } + } Message msg = new Message(); msg.what = 1; handler.sendMessage(msg); @@ -63,10 +85,15 @@ public class Transam implements Runnable { case 1: flag = true; break; - case 2: + case 2: + if(!reqlog){ res = new Myrespond(); res.wrong = msg.obj.toString(); core.recieveInfo(res); + } + else{ + log.failed(); + } break; case 3: final thd t = new thd(); -- cgit v1.2.3-70-g09d2