客户端
首先需要连接指定ip地址和指定端口号的服务器,获取数据输入流和数据输出流
private synchronized void connect() {
try {
socket = new Socket(IP, port);
state = running;
dis = new DataInputStream(new BufferedInputStream(
socket.getInputStream()));
dos = new DataOutputStream(new BufferedOutputStream(
socket.getOutputStream()));
oos = new ObjectOutputStream(socket.getOutputStream());
ois = new ObjectInputStream(