?? 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){}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -