I initially was try to get Protocol Buffers to work from Java to C++ over sockets. I am still unsure how to do this but I decided to try and test to see if I could get a Java to Java version working over sockets and was successful. However, I was experiencing a weirdness which might be causing the error on the C++ side of things.
Below is my code on the server side. Basically to make a long story short I thought that closing the stream was causing my C++ code to fail, so I put a little sleep in there to make sure it was still connected. Then when adding the java stuff I left the sleep in. Basically, the code that receives the data will wait until the stream is closed before reading the data. I thought that flushing the data would cause the data to be sent but that apparently has no effect. Is this my implementation or a problem with using the writeTo function? public class ProtoWriter { public static void main(String[] args) { Socket socket; ServerSocket serverSocket; ObjectOutputStream oos = null; serverSocket = new ServerSocket(12345); socket = serverSocket.accept(); oos = new ObjectOutputStream(socket.getOutputStream()); Measurement measurement = measBuilder.build(); measurement.writeTo(oos); oos.flush(); TimeUnit.SECONDS.sleep(10); oos.close(); -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.