否则抛出这种异常:
05-05 17:46:44.043: W/dalvikvm(5449): threadid=13: thread exiting with uncaught exception (group=0x41764498)
05-05 17:46:44.063: E/AndroidRuntime(5449): FATAL EXCEPTION: AsyncTask #2
05-05 17:46:44.063: E/AndroidRuntime(5449): java.lang.RuntimeException: An error occured while executing doInBackground()
05-05 17:46:44.063: E/AndroidRuntime(5449): at android.os.AsyncTask$3.done(AsyncTask.java:299)
05-05 17:46:44.063: E/AndroidRuntime(5449): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
05-05 17:46:44.063: E/AndroidRuntime(5449): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
05-05 17:46:44.063: E/AndroidRuntime(5449): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
05-05 17:46:44.063: E/AndroidRuntime(5449): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
05-05 17:46:44.063: E/AndroidRuntime(5449): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
05-05 17:46:44.063: E/AndroidRuntime(5449): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
05-05 17:46:44.063: E/AndroidRuntime(5449): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
05-05 17:46:44.063: E/AndroidRuntime(5449): at java.lang.Thread.run(Thread.java:856)
05-05 17:46:44.063: E/AndroidRuntime(5449): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
05-05 17:46:44.063: E/AndroidRuntime(5449): at android.os.Handler.<init>(Handler.java:121)
05-05 17:46:44.063: E/AndroidRuntime(5449): at android.widget.Toast$TN.<init>(Toast.java:335)
05-05 17:46:44.063: E/AndroidRuntime(5449): at android.widget.Toast.<init>(Toast.java:101)
05-05 17:46:44.063: E/AndroidRuntime(5449): at android.widget.Toast.makeText(Toast.java:248)
05-05 17:46:44.063: E/AndroidRuntime(5449): at com.bn.selectvege.SelectVegeActivity.showMessage(SelectVegeActivity.java:729)
05-05 17:46:44.063: E/AndroidRuntime(5449): at com.bn.selectvege.SelectVegeActivity.access$0(SelectVegeActivity.java:728)
05-05 17:46:44.063: E/AndroidRuntime(5449): at com.bn.selectvege.SelectVegeActivity$CallServe.doInBackground(SelectVegeActivity.java:694)
05-05 17:46:44.063: E/AndroidRuntime(5449): at com.bn.selectvege.SelectVegeActivity$CallServe.doInBackground(SelectVegeActivity.java:1)
05-05 17:46:44.063: E/AndroidRuntime(5449): at android.os.AsyncTask$2.call(AsyncTask.java:287)
05-05 17:46:44.063: E/AndroidRuntime(5449): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
05-05 17:46:44.063: E/AndroidRuntime(5449): ... 5 more
2.Socket 好像不能再构造器里面进行连接……