import java.io.IOException;
import java.net.UnknownHostException;


public class ChatRoomClient {
	public static void main(String[] args) {
		MySocket mySocket = null;
		
		try {
			String line = null;
			mySocket = new MySocket();
			ReadThread rt = new ReadThread(mySocket);
			Thread t = new Thread(rt);
			t.start();
			
			while(true) {
				System.out.print("请曰:");
				line = mySocket.readKey();
				mySocket.send(line);
			}
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			mySocket.close();
		}
	}
}

class ReadThread implements Runnable {
	private MySocket mySocket = null;
	
	public ReadThread(MySocket mySocket) {
		super();
		this.mySocket = mySocket;
	}


	@Override
	public void run() {
		String line;
		try {
			while(true) {
				line = mySocket.receive();
				System.out.println(line);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
}
最近下载更多
buhuia  LV4 2023年6月7日
linmou  LV8 2023年3月19日
dyrcl01  LV1 2021年7月16日
最后的低调~  LV1 2021年7月8日
2842539  LV1 2021年7月7日
哈七  LV1 2021年6月25日
ꪶꪮꪰꪤꫀ⅓¼  LV1 2021年6月7日
D  LV1 2021年5月13日
mewgulf  LV1 2020年12月2日
小小先生啊  LV4 2020年11月24日
最近浏览更多
dapeng0011  LV15 2024年7月18日
微信网友_7004855557083136  LV1 2024年5月22日
Ji123455  LV8 2023年9月21日
cksndh  LV4 2023年8月16日
yybb7435100  LV2 2023年8月7日
buhuia  LV4 2023年6月7日
林间听风  LV10 2023年4月7日
linmou  LV8 2023年3月19日
gzryue  LV6 2023年3月8日
heqian  LV17 2023年1月10日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友