?? clientthread.java
字號:
import java.io.*;
import java.net.*;
import java.util.*;
/**
* @author yeeku.H.lee kongyeeku@163.com
* @version 1.0
* <br>Copyright (C), 2005-2008, yeeku.H.Lee
* <br>This program is protected by copyright laws.
* <br>Program Name:
* <br>Date:
*/
public class ClientThread implements Runnable
{
//該線程負責處理的Socket
private Socket s;
//該現成所處理的Socket所對應的輸入流
BufferedReader br = null;
public ClientThread(Socket s)
throws IOException
{
this.s = s;
br = new BufferedReader(
new InputStreamReader(s.getInputStream()));
}
public void run()
{
try
{
String content = null;
//不斷讀取Socket輸入流中的內容,并將這些內容打印輸出
while ((content = br.readLine()) != null)
{
System.out.println(content);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -