當(dāng)前位置:首頁文章首頁 IT學(xué)院 IT技術(shù)

在Android下巧妙使用Socket連接網(wǎng)絡(luò)中的電腦

作者:  來源:  發(fā)布時(shí)間:2011-4-19 19:29:29  點(diǎn)擊:
   String str=in.readLine();

   System.out.println("read:"+str);

   //向服務(wù)器發(fā)送消息

   PrintWriter out=new PrintWriter(new BufferedWriter(new OutputStreamWriter(client.getOutputStream())),true);

   out.println("Server Message:"+str);

   in.close();

   out.close();

   }catch(Exception ex)

   {

   System.out.println(ex.getMessage());

   ex.printStackTrace();

   }

   finally

   {

   client.close();

   System.out.println("close");

   }

   }

   } catch (IOException e) {

   System.out.println(e.getMessage());

   }

   }

  

  }

 

文章評(píng)論

軟件按字母排列: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z