| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 539 人关注过本帖
标题:请大家帮我找出这些的注释下
只看楼主 加入收藏
zhisenhu
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-8-9
收藏
 问题点数:0 回复次数:0 
请大家帮我找出这些的注释下
import *;
import *;

public class client2 {
    public static void main(String args[]){
        try {
        Socket s = new Socket("127.0.0.1", 6666);
        Runnable userInput = new keyboardIn(s);
        Runnable serverInput = new serverIn(s);
        Thread t1 = new Thread(userInput);
        Thread t2 = new Thread(serverInput);
        t1.start();
        t2.start();
        //s.close();
        }
        catch(Exception e){
            e.printStackTrace();
        }
    }
}

class keyboardIn implements Runnable {
    Socket s;
    public keyboardIn(Socket s) {
        this.s = s;
    }

    public void run() {
        try {
            BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
            PrintWriter out = new PrintWriter(s.getOutputStream(),true);
            String line = null;
            while((line = input.readLine()) != null){
                out.println(line);
                if("exit".equals(line)){
                    break;
                }
            }
        }catch(IOException e){
            e.printStackTrace();
        }
    }
}

class serverIn implements Runnable {
    Socket s;
    public serverIn(Socket s) {
        this.s = s;
    }
   
    public void run() {
        try {
        BufferedReader bufr = new BufferedReader(new InputStreamReader(s.getInputStream()));
        String line = null;
        while((line = bufr.readLine()) != null){
            System.out.println("督昢傷ㄩ"+line);
            }
        }catch(IOException e){
            e.printStackTrace();
        }
    }
搜索更多相关主题的帖子: void Socket public import 
2012-08-09 18:11
快速回复:请大家帮我找出这些的注释下
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024794 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved