Re: 2.0.3rc1
I think the problem may be that the script was written on unix, so it does not expect protoc to have the .exe extension. That's a bug that should be fixed. I'm surprised it hasn't been reported before. Does it work if you put protoc.exe somewhere in your PATH? On Wed, Dec 17, 2008 at 4:04 AM, 王鹏生 pengshengw...@gmail.com wrote: Hi, I download protoc-2.0.3-win32.zip and protobuf-2.0.3.zip from http://code.google.com/p/protobuf/downloads/list Unzip protobuf-2.0.3.zip to C:\Python25\protobuf-2.0.3 and put protoc.exe to C:\Python25\protobuf-2.0.3\src\ Then, I run the command: C:\Python25\protobuf-2.0.3\pythonsetup.py install But it told me that protoc is not installed nor found in ../src. Why? How? Thanks! I test the other version like protobuf-2.0.2 and protobuf-2.0.1 but it had the same problem... The detail message as below: C:\Python25\protobuf-2.0.3\pythonsetup.py install --- This script requires setuptools version 0.6c8 to run (even to display help). I will attempt to download it for you (from http://pypi.python.org/packages/2.5/s/setuptools/), but you may need to enable firewall access for this script first. I will start the download in 15 seconds. (Note: if this machine does not have network access, please obtain the file http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c8-py2.5.egg and place it in this directory before rerunning this script.) --- Downloading http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c8-py 2.5.egg Generating google/protobuf/descriptor_pb2.py... protoc is not installed nor found in ../src. Please compile it or install the b inary package. 2008/12/3 Kenton Varda ken...@google.com: You need to run setup.py from the directory where it resides. On Tue, Dec 2, 2008 at 11:51 PM, EYN pengshengw...@gmail.com wrote: I can not install it: C:\Python25python C:\Python25\protobuf-2.0.3rc1\python\setup.py install Can't find required file: ../src/google/protobuf/descriptor.proto On 11月26日, 上午10时32分, Kenton Varda ken...@google.com wrote: I just put a release candidate here:http://groups.google.com/group/protobuf/files Test and tell me what's broken. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@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 -~--~~~~--~~--~--~---
Re: Enum for field numbers
OK, I'll stick it on my TODO list. Feel free to send me a patch if you want it done faster. :) On Tue, Dec 16, 2008 at 10:53 PM, sorent soren.torstens...@tietoenator.comwrote: Definitely a better idea better :-) /Sören --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@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 -~--~~~~--~~--~--~---
Re: C++ SerializeToArray
char mess[MAX_MESSLEN] ; . //Load some properties for the group com call . . bplMessage.SerializeToArray(mess,bplMessage.ByteSize()); //what I am using to detect trailing bytes for(int i =0; i bplMessage.ByteSize();i++) { std::cout (int) mess[i] std::endl; } On Dec 17, 8:32 am, Kenton Varda ken...@google.com wrote: Hi Ryan, What does your code look like that calls SerializeToArray()? It should be something like: int size = message.ByteSize(); char* array = new char[size]; message.SerializeToArray(array, size); On Tue, Dec 16, 2008 at 8:13 PM, Ryan ryanroll...@gmail.com wrote: I have been working with a Group Communication System and Protocol Buffers. I have an issue where the C++ SerializeToArray call on one of my messages is occasionally appending Bytes {1,0,0,0,0,0,0,0,0} to the end of the returned character array? Any ideas on what might be causing this? I can Marshall/Unmarshall fine using the java api but the C++ call above has the odd quirk mentioned. The Java parsingFrom fails on the C++ generated messages that have the above bytes appended. Any suggestions 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 protobuf@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 -~--~~~~--~~--~--~---
Re: 2.0.3rc1
Hi, I download protoc-2.0.3-win32.zip and protobuf-2.0.3.zip from http://code.google.com/p/protobuf/downloads/list Unzip protobuf-2.0.3.zip to C:\Python25\protobuf-2.0.3 and put protoc.exe to C:\Python25\protobuf-2.0.3\src\ Then, I run the command: C:\Python25\protobuf-2.0.3\pythonsetup.py install But it told me that protoc is not installed nor found in ../src. Why? How? Thanks! I test the other version like protobuf-2.0.2 and protobuf-2.0.1 but it had the same problem... The detail message as below: C:\Python25\protobuf-2.0.3\pythonsetup.py install --- This script requires setuptools version 0.6c8 to run (even to display help). I will attempt to download it for you (from http://pypi.python.org/packages/2.5/s/setuptools/), but you may need to enable firewall access for this script first. I will start the download in 15 seconds. (Note: if this machine does not have network access, please obtain the file http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c8-py2.5.egg and place it in this directory before rerunning this script.) --- Downloading http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c8-py 2.5.egg Generating google/protobuf/descriptor_pb2.py... protoc is not installed nor found in ../src. Please compile it or install the b inary package. 2008/12/3 Kenton Varda ken...@google.com: You need to run setup.py from the directory where it resides. On Tue, Dec 2, 2008 at 11:51 PM, EYN pengshengw...@gmail.com wrote: I can not install it: C:\Python25python C:\Python25\protobuf-2.0.3rc1\python\setup.py install Can't find required file: ../src/google/protobuf/descriptor.proto On 11月26日, 上午10时32分, Kenton Varda ken...@google.com wrote: I just put a release candidate here:http://groups.google.com/group/protobuf/files Test and tell me what's broken. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@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 -~--~~~~--~~--~--~---
Re: C++ SerializeToArray
I will try. A good debugging step for myself if not anything else. This system is of course distributed so it may be difficult to isolate it down into something I can send you easily (also lots of dependencies). I have been trying to identify the messages that are causing this but it appears to be happening independent of the message contents. In a particular sequence of messages the same messages always get the erroneous bytes appended. However, if I take one of those messages and send it independently - works fine. Weird... Thanks for the dialog. On Dec 17, 9:36 am, Kenton Varda ken...@google.com wrote: If you write a program demonstrating the problem and send it to me, I can debug it. On Wed, Dec 17, 2008 at 11:10 AM, Ryan ryanroll...@gmail.com wrote: char mess[MAX_MESSLEN] ; . //Load some properties for the group com call . . bplMessage.SerializeToArray(mess,bplMessage.ByteSize()); //what I am using to detect trailing bytes for(int i =0; i bplMessage.ByteSize();i++) { std::cout (int) mess[i] std::endl; } On Dec 17, 8:32 am, Kenton Varda ken...@google.com wrote: Hi Ryan, What does your code look like that calls SerializeToArray()? It should be something like: int size = message.ByteSize(); char* array = new char[size]; message.SerializeToArray(array, size); On Tue, Dec 16, 2008 at 8:13 PM, Ryan ryanroll...@gmail.com wrote: I have been working with a Group Communication System and Protocol Buffers. I have an issue where the C++ SerializeToArray call on one of my messages is occasionally appending Bytes {1,0,0,0,0,0,0,0,0} to the end of the returned character array? Any ideas on what might be causing this? I can Marshall/Unmarshall fine using the java api but the C++ call above has the odd quirk mentioned. The Java parsingFrom fails on the C++ generated messages that have the above bytes appended. Any suggestions 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 protobuf@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 -~--~~~~--~~--~--~---
Looking for an idea to implement a network application with protobuf
Hi, I'm currently trying to write a prototype client / server application that exchanges a message which is encoded with protobuf format. From my understanding, it seems like a user usually defines a top level message type that can be a container of other messages. This approach is called 'extension', and is described here in detail: * Official documentation - http://tinyurl.com/56cerv * Forum discussion - http://tinyurl.com/5zabns The question is, is this the most common and efficient way to exchange various types of messages with protobuf? What did you do to build a network application with many complex message types? Is there any alternative approach that might be used in a certain case? I'd like to hear your experience. Thanks, Trustin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@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 -~--~~~~--~~--~--~---
Re: C++ SerializeToArray
Ok - found it. The problem was not on the serialization but on the message creation/parsing. The buffer the C++ code was parsing the protocol buffer message from was not properly initialized causing the ByteSize() function to return an incorrect value based on the junk padded past the typical sentinel. I did a call to memset prior and all is good. Two additional thoughts: 1) I am surprised the C++ parsing succeeded? 2) Why was the serialization reproducing the bad input? I would think the process of Marshalling/Unmarshalling would of cleaned it up. On Dec 17, 10:48 am, Ryan ryanroll...@gmail.com wrote: I will try. A good debugging step for myself if not anything else. This system is of course distributed so it may be difficult to isolate it down into something I can send you easily (also lots of dependencies). I have been trying to identify the messages that are causing this but it appears to be happening independent of the message contents. In a particular sequence of messages the same messages always get the erroneous bytes appended. However, if I take one of those messages and send it independently - works fine. Weird... Thanks for the dialog. On Dec 17, 9:36 am, Kenton Varda ken...@google.com wrote: If you write a program demonstrating the problem and send it to me, I can debug it. On Wed, Dec 17, 2008 at 11:10 AM, Ryan ryanroll...@gmail.com wrote: char mess[MAX_MESSLEN] ; . //Load some properties for the group com call . . bplMessage.SerializeToArray(mess,bplMessage.ByteSize()); //what I am using to detect trailing bytes for(int i =0; i bplMessage.ByteSize();i++) { std::cout (int) mess[i] std::endl; } On Dec 17, 8:32 am, Kenton Varda ken...@google.com wrote: Hi Ryan, What does your code look like that calls SerializeToArray()? It should be something like: int size = message.ByteSize(); char* array = new char[size]; message.SerializeToArray(array, size); On Tue, Dec 16, 2008 at 8:13 PM, Ryan ryanroll...@gmail.com wrote: I have been working with a Group Communication System and Protocol Buffers. I have an issue where the C++ SerializeToArray call on one of my messages is occasionally appending Bytes {1,0,0,0,0,0,0,0,0} to the end of the returned character array? Any ideas on what might be causing this? I can Marshall/Unmarshall fine using the java api but the C++ call above has the odd quirk mentioned. The Java parsingFrom fails on the C++ generated messages that have the above bytes appended. Any suggestions 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 protobuf@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 -~--~~~~--~~--~--~---
Re: C++ SerializeToArray
When you call ParseFromArray(), you must pass the exact size of the message being parsed. You cannot simply give it the size of the buffer if there are extra bytes after the end of the message. What happened here is that the parser, after parsing the bytes of your actual message, continued to interpret the following bytes as more data. The next byte was a 1, which the parser thought was indicating the beginning of a 64-bit fixed-width field with field number zero. Since your message does not declare a field number zero (you actually aren't allowed to), it treated this as an unknown field and stored the value in the UnknownFieldSet. Later, when you serialized the message, the value in the UnknownFieldSet was written out again. The moral of the story is that you must transmit the size of your message along with the data, so that you can pass it to ParseFromArray() on the receiving end. On Wed, Dec 17, 2008 at 2:22 PM, Ryan ryanroll...@gmail.com wrote: Ok - found it. The problem was not on the serialization but on the message creation/parsing. The buffer the C++ code was parsing the protocol buffer message from was not properly initialized causing the ByteSize() function to return an incorrect value based on the junk padded past the typical sentinel. I did a call to memset prior and all is good. Two additional thoughts: 1) I am surprised the C++ parsing succeeded? 2) Why was the serialization reproducing the bad input? I would think the process of Marshalling/Unmarshalling would of cleaned it up. On Dec 17, 10:48 am, Ryan ryanroll...@gmail.com wrote: I will try. A good debugging step for myself if not anything else. This system is of course distributed so it may be difficult to isolate it down into something I can send you easily (also lots of dependencies). I have been trying to identify the messages that are causing this but it appears to be happening independent of the message contents. In a particular sequence of messages the same messages always get the erroneous bytes appended. However, if I take one of those messages and send it independently - works fine. Weird... Thanks for the dialog. On Dec 17, 9:36 am, Kenton Varda ken...@google.com wrote: If you write a program demonstrating the problem and send it to me, I can debug it. On Wed, Dec 17, 2008 at 11:10 AM, Ryan ryanroll...@gmail.com wrote: char mess[MAX_MESSLEN] ; . //Load some properties for the group com call . . bplMessage.SerializeToArray(mess,bplMessage.ByteSize()); //what I am using to detect trailing bytes for(int i =0; i bplMessage.ByteSize();i++) { std::cout (int) mess[i] std::endl; } On Dec 17, 8:32 am, Kenton Varda ken...@google.com wrote: Hi Ryan, What does your code look like that calls SerializeToArray()? It should be something like: int size = message.ByteSize(); char* array = new char[size]; message.SerializeToArray(array, size); On Tue, Dec 16, 2008 at 8:13 PM, Ryan ryanroll...@gmail.com wrote: I have been working with a Group Communication System and Protocol Buffers. I have an issue where the C++ SerializeToArray call on one of my messages is occasionally appending Bytes {1,0,0,0,0,0,0,0,0} to the end of the returned character array? Any ideas on what might be causing this? I can Marshall/Unmarshall fine using the java api but the C++ call above has the odd quirk mentioned. The Java parsingFrom fails on the C++ generated messages that have the above bytes appended. Any suggestions 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 protobuf@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 -~--~~~~--~~--~--~---
Re: 2.0.3rc1
Yes, protoc.exe can work when I ask it to create the example file addressbook.proto. 2008/12/18 Kenton Varda ken...@google.com: I think the problem may be that the script was written on unix, so it does not expect protoc to have the .exe extension. That's a bug that should be fixed. I'm surprised it hasn't been reported before. Does it work if you put protoc.exe somewhere in your PATH? On Wed, Dec 17, 2008 at 4:04 AM, 王鹏生 pengshengw...@gmail.com wrote: Hi, I download protoc-2.0.3-win32.zip and protobuf-2.0.3.zip from http://code.google.com/p/protobuf/downloads/list Unzip protobuf-2.0.3.zip to C:\Python25\protobuf-2.0.3 and put protoc.exe to C:\Python25\protobuf-2.0.3\src\ Then, I run the command: C:\Python25\protobuf-2.0.3\pythonsetup.py install But it told me that protoc is not installed nor found in ../src. Why? How? Thanks! I test the other version like protobuf-2.0.2 and protobuf-2.0.1 but it had the same problem... The detail message as below: C:\Python25\protobuf-2.0.3\pythonsetup.py install --- This script requires setuptools version 0.6c8 to run (even to display help). I will attempt to download it for you (from http://pypi.python.org/packages/2.5/s/setuptools/), but you may need to enable firewall access for this script first. I will start the download in 15 seconds. (Note: if this machine does not have network access, please obtain the file http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c8-py2.5.egg and place it in this directory before rerunning this script.) --- Downloading http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c8-py 2.5.egg Generating google/protobuf/descriptor_pb2.py... protoc is not installed nor found in ../src. Please compile it or install the b inary package. 2008/12/3 Kenton Varda ken...@google.com: You need to run setup.py from the directory where it resides. On Tue, Dec 2, 2008 at 11:51 PM, EYN pengshengw...@gmail.com wrote: I can not install it: C:\Python25python C:\Python25\protobuf-2.0.3rc1\python\setup.py install Can't find required file: ../src/google/protobuf/descriptor.proto On 11月26日, 上午10时32分, Kenton Varda ken...@google.com wrote: I just put a release candidate here:http://groups.google.com/group/protobuf/files Test and tell me what's broken. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@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 -~--~~~~--~~--~--~---