Hi, On Wed, Dec 2, 2009 at 15:21, Nigel Pickard <[email protected]> wrote: > Henner: > > I'm not sure what you mean by the datastream being transparent, but > basically I'm sending a GPB instance from the server to the client. > Initially I used ObjectOutputStream on the server, ObjectInputStream > on the client. I then changed the client to use DataInputStream > (apologies, my previous post stated output when I meant input).
transparent as in: the same data is written out that you put in. If you see a difference then this might be because the ObjectOutputStream might add something to the data you provide, such as writing delimiters or something. So I guess the simple write(byte[]) will not actually write the content of the arrays but as well the length or something (this is a wild guess - haven't looked at the sources, but it would explain what you see). Why do you use the ObjectOutputStream anyway instead of the simpler OutputStream ? > > I'm just sending one instance each run for simplicity (my object is a > simple one) -the exact same GPB instance that worked when I used > Object IO streams on the client and server that worked -and then > stopping. The only thing that has changed has been the input stream > type on the client. > > Basically, on the client side I called the GPB object's "parseFrom" > method with the DataInputStream.as an argument and expected it to work > but got that error message. > > > > > On Dec 2, 4:17 pm, Henner Zeller <[email protected]> wrote: >> Are your ObjectOutputStreams transparent ? Or do they prepend/append >> things to the data ? >> >> On Wed, Dec 2, 2009 at 13:11, Nigel Pickard <[email protected]> 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 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 >> > and parseFrom on the GBP object successfully. >> >> > If I understand the previous posts correctly it should not make a >> > difference which outputstream or inputstream type I use, right? The >> > stream of whatever type it is should just be a series of bytes, able >> > to be parsed by my GBP object.... But if I change my >> > ObjectOutputStream to DataOutputStream on my client (so I'm leaving my >> > server still using ObjectInputStream) I get the following error: >> >> > "com.google.protobuf.InvalidProtocolBufferException: Protocol message >> > end-group tag did not match expected tag." >> >> > Wouldn't this suggest there is a difference (at least in Java) >> > concerning which inputstream you use? >> >> > -- >> >> > You received this message because you are subscribed to the Google Groups >> > "Protocol Buffers" group. >> > To post to this group, send email to [email protected]. >> > To unsubscribe from this group, send email to >> > [email protected]. >> > For more options, visit this group >> > athttp://groups.google.com/group/protobuf?hl=en. > > -- > > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/protobuf?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
