2014/9/29
1 1 package hello; 2 3 import java.io.DataInputStream; 4 import java.net.*; 5 6 public class helloworld 7 { 8 public static void main(String[] args)throws Exception 9 { 10 ServerSocket s = new ServerSocket(6666); //server端口号,用于监听 11 Socket ss = s.accept(); //闭塞式,不收到不进行下去 12 System.out.println("A is accepted;"); 13 DataInputStream dis = new DataInputStream(ss.getInputStream()); // 14 System.out.println(dis.readUTF()); // 15 dis.close(); 16 s.close(); 17 } 18 } 19 20 package ha; 21 import java.io.*; 22 import java.net.*; 23 import java.util.*; 24 public class wori 25 { 26 public static void main