📄 client.java
字号:
import java.io.*;
import java.net.*;
class Client
{
public static void main(String[] args)
{
Client();
}
public static void Client()
{
try{
Socket s=new Socket("Localhost",6000);
InputStream is=s.getInputStream();
OutputStream os=s.getOutputStream();
byte[] buf=new byte[100];
int len=is.read(buf);
System.out.println(new String(buf,0,len));
os.write("How do you do,I am new here.".getBytes());
is.close();
os.close();
s.close();
}catch (Exception e)
{
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -