S
S
Stalder2016-03-30 16:01:23
Java
Stalder, 2016-03-30 16:01:23

Why does the program hang when creating an ObjectInputStream?

System.out.print("Я здесь"); //выводит
            in = new ObjectInputStream(socket.getInputStream());
            System.out.print("Я здесь1"); //не выводит
            out = new ObjectOutputStream(socket.getOutputStream());
            System.out.print("Я здесь2");

If ObjectInputStream is replaced with DataInputStream everything works fine. What could be the reason?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2016-03-30
@Stalder

Docs: https://docs.oracle.com/javase/7/docs/api/java/io/...

This constructor will block until the corresponding ObjectOutputStream has written and flushed the header.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question