Клиентская часть
private static Socket socket;
public static void init() {
try {
socket = new Socket("localhost",8888);
handle();
} catch (IOException e) {
e.printStackTrace();
}
}
private static void handle() throws IOException {
ObjectOutputStream dos = new ObjectOutputStream(socket.getOutputStream());
Definition def = new Definition("g", "gbv");
System.out.println(def.hashCode());
dos.writeObject(def);
dos.flush();
}
Серверная часть
@Override
public void run() {
while (true) {
try {
ObjectInputStream dis = new ObjectInputStream(this.client.getInputStream());
dis.readObject();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Возникает ошибка
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully
Пишу с maven. Класс Definition написан в одном из модулей