📄 serveur.java
字号:
import java.net.*;
import java.io.*;
public class serveur{
ServerSocket ss;
public serveur(int port) throws IOException
{
ss=new ServerSocket(port);
}
public void go()
{
while (true)
{
try
{
Socket so = ss.accept();
echange(so.getInputStream(), so.getOutputStream());
so.close();
}
catch (IOException e)
{ }
}
}
public void echange(InputStream is,OutputStream os) throws IOException
{
DataOutputStream dos=new DataOutputStream(os);
dos.writeUTF("Hello net Wrold!!");
DataInputStream dis = new DataInputStream(is);
String tmp = dis.readUTF();
System.out.println(tmp);
}
public static void main(String argc[])
{
try{
serveur s = new serveur(3000);
s.go();
}
catch(IOException e){}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -