public class Server1 {
public static void main(String[] args) {
ServerSocket server= null;
Socket you = null;
DataInputStream in = null;
DataOutputStream out = null;
try{
server = new ServerSocket(1420);
you = server.accept();
}catch (IOException e1){
System.out.println("连接不上");
}
try{
in = new DataInputStream(you.getInputStream());
out = new DataOutputStream(you.getOutputStream());
int m = 0;
while(true){
m = in.readInt();
out.writeUTF("你说的数字对应的字符为"+(char)m);
System.out.println("服务器收到:"+m);
Thread.sleep(500);
}
}catch(IOException e){
System.out.println(""+e);
}catch(InterruptedException e2){}