?? myclient.java
字號(hào):
import java.net.*;
import java.io.*;
/**
* @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 MyClient
{
public static void main(String[] args)
throws IOException
{
Socket s = s = new Socket("127.0.0.1" , 30000);
//客戶端啟動(dòng)ClientThread線程不斷讀取來自服務(wù)器的數(shù)據(jù)
new Thread(new ClientThread(s)).start();
//獲取該Socket對(duì)應(yīng)的輸出流
PrintStream ps = new PrintStream(s.getOutputStream());
String line = null;
//不斷讀取鍵盤輸入
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while ((line = br.readLine()) != null)
{
//將用戶的鍵盤輸入內(nèi)容寫入Socket對(duì)應(yīng)的輸出流
ps.println(line);
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -