//服务器监听: ServerSocket s=new ServerSocket ( port ); Socket socket=s.accept(); //客户端连接: Socket socket= new Socket ( String ip, int port );