I've just been looking more - and ParseFromString should do the job.
I /suspect/ the problem is the definition a string... you aren't
going to be able to treat raw binary in .NET as a String; you are
going to have to treat it as a Stream or a byte[], or you can encode
it to base-64 (as above) to
Marc,
The server is using ProtoBuf 2.0.1. I had to upgrade my .net version
to the latest protobuf-net in order to have protogen work with
optional fields correctly.
It seems that the server only processes bytes up to the 1st NULL char
when calling ParseFromString. Will this problem be avoided
Hi; I'm the author of protobuf-net, and I hope I can help you find
what is going on here...
The binary format should be compatible between platforms (that is the
point, after all). Are you able to share your OrderProto class with
me? Either here, or at marc.grav...@gmail.com. The base-64 should
It seems I was wrong in trying to use ASCII or UTF-8 encoding. This
works.
private string Serialize(OrderProto proto)
{
using (MemoryStream stream = new MemoryStream())
{
Serializer.SerializeOrderProto(stream, proto);
using
Actually, I was wrong, this code produces an empty string. The
following code serializes *something* which fails on the server side
on ParseFromString. Any ideas what I have to do to correctly serialize
this?
private string Serialize(OrderProto proto)
{
using
Quick question - which build are you using? (at client and server)?
Based on the field names, the code-generation dates back to November;
if the dlls are aged similarly, it is possible that this is an old
bug. If possible, can you retry with the current build?
I'm just trying the code you
You can't use unicode to transport arbitrary binary data - it won't be
a valid unicode string. If you have to use strings, then base-64 is
the safest option:
private string Serialize(OrderProto proto)
{
using (MemoryStream stream = new MemoryStream())
{
(re last post)
As with unicode, you can't use ASCII to handle raw binary; either use
base-64 (previous post), or send binary.
Marc
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Protocol Buffers group.
To post to