📄 helloclient.java
字号:
import java.io.*;
import java.net.*;
public class helloClient
{
public static void main(String[] args) throws IOException
{
Socket helloSocket = null;
PrintWriter out = null;
BufferedReader in = null;
try
{
helloSocket = new Socket ( "localhost", 1111);
out = new PrintWriter(helloSocket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(helloSocket.getInputStream()));
}
catch (UnknownHostException e)
{
System.err.println("Don't know about host: localhost.");
System.exit(1);
}
catch (IOException e)
{
System.err.println("Couldn't get I/O for the connection .");
System.exit(1);
}
System.out.println(in.readLine());
out.close();
in.close();
helloSocket.close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -