[protobuf] Java -using GPB -which type of stream should I be using over sockets?

2009-12-02 Thread Nigel Pickard
OK, so far I like GPB. However, I have a very simple question, but one which I can't find an answer for: I have created a test Java application that uses ObjectInputStream and ObjectOutputStream over sockets. No problems, it works! I use my GPB class writeTo and parseFrom to send and reconstitut

[protobuf] Re: Java -using GPB -which type of stream should I be using over sockets?

2009-12-02 Thread Nigel Pickard
Thanks for the reply Adam -I did a simple sub into my code with your suggestion, but it doesn't work. However, now it's made me think of more questions. If protocol buffers doesn't use object I/O streams, which streams does it use? The argument in Java simply asks for an OutputStream argumen

[protobuf] Re: Java -using GPB -which type of stream should I be using over sockets?

2009-12-02 Thread Nigel Pickard
mat to the > OutputStream. From a socket, just do: > > MyProtoBuf pb = new MyProtoBuf; > ... > pb.writeTo(socket.getOutputStream()); > > On Wed, Dec 2, 2009 at 7:47 AM, Nigel Pickard wrote: > > > OK, so far I like GPB.  However, I have a very simple question, but >

[protobuf] Re: Java -using GPB -which type of stream should I be using over sockets?

2009-12-02 Thread Nigel Pickard
Aaaah I think the fog is lifting. thanks! So am I correct in thinking that byte order is taken in to account by the GPB writeTo and parseFrom methods, no matter whether it's Java, C+ +, etc? On Dec 2, 3:25 pm, Kenton Varda wrote: > It doesn't matter what kind of stream you use.  Protobufs ju

[protobuf] Re: Java -using GPB -which type of stream should I be using over sockets?

2009-12-02 Thread Nigel Pickard
Adam, Jason, Kenton and Henner, thanks and much appreciated! -- 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...@

[protobuf] Re: Java -using GPB -which type of stream should I be using over sockets?

2009-12-02 Thread Nigel Pickard
Oh, wait So I have a test Java app where one thread is running as a server, one as a client. I've been sending a GPB defined class instance between them, no problem when I use Object I/O streams (e.g. ObjectOutputStream on the server, ObjectInputStream on the client. I've been calling writeTo

[protobuf] Re: Java -using GPB -which type of stream should I be using over sockets?

2009-12-02 Thread Nigel Pickard
OutputStreams transparent ? Or do they prepend/append > things to the data ? > > On Wed, Dec 2, 2009 at 13:11, Nigel Pickard wrote: > > Oh, wait So I have a test Java app where one thread is running as > > a server, one as a client. > > > I've been sending

[protobuf] Re: Java -using GPB -which type of stream should I be using over sockets?

2009-12-02 Thread Nigel Pickard
When the Java test app works, I'd say the IO stream is transparent. I use the same simple object instance each time (have a hard coded method that simply returns the same object so it's identical), and I simply call the toString of the instance to see what it is (before I call writeTo on the serve

[protobuf] Re: Java -using GPB -which type of stream should I be using over sockets?

2009-12-03 Thread Nigel Pickard
Jason: You know that's what I thought too about the InputStream/OutputStream after reading the Javadoc. I'm using Eclipse Galileo with Java 1.6.0.17 -for some reason it let me compile it and run it, creating an instance -I figured that was probably one of the problems. I'll post some code later.

[protobuf] Re: Java -using GPB -which type of stream should I be using over sockets?

2009-12-03 Thread Nigel Pickard
Here's my sample code. In this code, everything works for me -however when I change the GPBClient to use Data IO streams (just comment out the Object IO references and uncomment the Data IO references in GPBClient), that's when I get the "com.google.protobuf.InvalidProtocolBufferException: Protoco

[protobuf] Re: Java -using GPB -which type of stream should I be using over sockets?

2009-12-07 Thread Nigel Pickard
Oliver: thanks for the reply. I'm not going to use Object IO streams, rather I used it as an example of how the IO stream type seems to make a difference at each end. Further, I now realize that once I use an IO stream type, I must use the same type of stream at each ends of a Java app I was

[protobuf] How to assign a singel nested object value in C++?

2009-12-29 Thread Nigel Pickard
I'm having a problem working out how to assign a nested object's value in C++ (my Java version works fine). E.g. in the proto file for my car object I define: import "mycustomengine.proto"; message MyCar { optional string name = 1; optional string model = 2; optional MyCustomEngine cust

[protobuf] Re: How to assign a singel nested object value in C++?

2009-12-29 Thread Nigel Pickard
Henner: excellent, that worked I knew someone must have done that already! Thanks again, Nigel -- 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 g

[protobuf] Reading different message types from the same input

2010-01-07 Thread Nigel Pickard
I read various messages on this subject in the message board, but couldn't really find what I was looking for. Here is what I'd like to do: 1. I have messages of type Animal, Vegetable and Mineral. 2. I want to send these 3 dissimilar objects of Animal, Vegetable and Mineral to a file or output s

[protobuf] Problem with C++ -writing multiple messages with a repeated field to a file

2011-05-13 Thread Nigel Pickard
I'm having a problem writing multiple messages to a file and reading them back in c++ using GPB 2.3.0. What I'm trying to do: I have a GPB generated object that contains a repeated field, e.g. myobject.proto is: message MyObject { required uint64 x =1; required uint32

[protobuf] Re: Problem with C++ -writing multiple messages with a repeated field to a file

2011-05-16 Thread Nigel Pickard
Thanks Evan, I'll give this a try. I have actually got the code working, but it involves creating a new output stream everytime I write to it (surely got to be wasteful and not the right way?). Nigel On May 13, 11:50 am, Evan Jones wrote: > On May 13, 2011, at 10:12 , Nigel Picka