客户端链接服务器代码:
 private void connectToServer() {
  try {
      // Create a socket to connect to the server
  Socket socket=null;
  if (isStandAlone)
  socket = new Socket(IP, port);
      else
  socket = new Socket(getCodeBase().getHost(), port);
  toServer = new ObjectOutputStream(socket.getOutputStream());
  }
  catch (Exception ex) {
    System.err.println(ex);
  }
}
客户端发送点向量代码:private void sendPointVector(Vector<Point>  v )  throws  IOException {
      toServer.writeObject(v);
      System.out.println("传点向量中。");
}服务器端连接客户端代码:
private void connectToClient() {
  try {
  ServerSocket S_socket=null;
  S_socket = new ServerSocket(port);
  Socket socket = S_socket.accept();
  System.out.println("客户端到服务器的链接已建立");
  fromServer = new ObjectInputStream(socket.getInputStream());
  System.out.println("fromeServer输入流已经建立");
  }
  catch (Exception ex) {
    System.err.println(ex);
  }
     }服务器端接收点向量方法:
public void getClientPointVector() throws IOException {
      System.out.println("正在接受客户端发来的数据。");
      Vector<Point> Vec = new Vector<Point>();//点信息向量组
try {
if(VectorClass.isInstance(fromServer.readObject()))
{
    Vector<Point> readObject = (Vector<Point>)fromServer.readObject();
Vec=readObject;
    paintInfo=Vec;
    System.out.println("收到了"+paintInfo.size()+"个点");
    repaint();
    
}
else 
System.out.println("接收的数据格式错误!");
    } catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}Point是我自己写的,implements了序列化接口