📄 client.java
字号:
/** * time-of-day Client. * * @author Greg Gagne, Avi Silberschatz, Peter Galvin - June 2001. * * Usage: * java Client [host name] */import java.net.*;import java.io.*;public class Client{ public static void main(String[] args) throws IOException { String host; if (args.length == 0) host = "127.0.0.1"; else host = args[0].trim(); InputStream in = null; BufferedReader bin = null; Socket sock = null; try { sock = new Socket(host, 5155); in = sock.getInputStream(); bin = new BufferedReader(new InputStreamReader(in)); String line; while( (line = bin.readLine()) != null) System.out.println(line); } catch (IOException ioe) { System.err.println(ioe); } finally { if (in != null) in.close(); if (bin != null) bin.close(); if (sock != null) sock.close(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -