Why did parseFrom() function hang using protobuf in java socket? <p>I just want to create echo server/client using protobuf and java.</p> <p>I tested with protobuf-java-2.4.1 and jdk1.7.</p> <p>I wrote echo server code like below</p> <pre><code>// create server socket and accept for client connection. // ... link = servSock.accept(); Person person = Person.parseFrom(link.getInputStream()); // blocking position person.writeTo(link.getOutputStream()); </code></pre> <p>I think it is not necessary to note Person.proto.</p> <p>The client code is only send Person object using socket input stream and receive echo Person object.</p> <pre><code>// socket connect code was omitted. Person person = Person.newBuilder().setId(1).setName("zotiger").build(); person.writeTo(echoSocket.getOutputStream()); person = Person.parseFrom(echoSocket.getInputStream()); </code></pre> <p>But server was blocked in parseFrom function when the server and client both run.</p> <p>I found if i use writeDelimitedTo() and parseDelimitedFrom(), then that is ok. I don't understand why the writeTo() and parseFrom() function does not working.</p> <p>Why did the server blocking in there?</p> <p>Is it necessary to send some end signal from client side?</p>