📄 simpleclient.java
字号:
package net;
import java.net.*;
import java.io.*;
public class SimpleClient {
public static void main(String args[]) {
try {
// Open your connection to a server, at port 5432
// localhost used here
Socket s1 = new Socket("127.0.0.1", 5432);
// Connect a reader to the socket
BufferedReader br = new BufferedReader(
new InputStreamReader(s1.getInputStream()));
// Read the input and print it to the screen
System.out.println(br.readLine());
// When done, just close the steam and connection
br.close();
s1.close();
} catch (ConnectException connExc) {
System.err.println("Could not connect to the server.");
} catch (IOException e) {
// ignore
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -