Hi Guys,

I'm having a very hard trying to get Python to send protocol buffer 
messages to Java code. I was able to send ProtocolBuffer message from Java 
to Python successful. But when I try to send from Python to Java using the 
following code, the java parseFrom read method gets stuck. I've been 
debugging the protocolBuffer code for a while but the code seem to use tags 
which I don't understand. I tried reading the data using readLine but the 
the read always gets stuck and I guess it's need to know that it's the EOF 
it's looking for '\n' or '\r'. But \n or \r only work when I'm sending 
plain text instead of Protocol buffer objects. Please helppp !!

response2 = ProtoResponseMessage()
response2.response = "I'm ALIVE"
serializedMessage = response2.SerializeToString()
MSGLEN = len(serializedMessage)
header = struct.pack('<L', MSGLEN)
print header + serializedMessage
clientSocket.sendall(header + serializedMessage)

*I've also tried*
clientSocket.send(response2.SerializeToString()) ... (The Java code still 
needs an EOF)
clientSocket.send('\n') in Python code. But it does not work. I cannot 
close the socket as I need them open. 

ProtoResponseMessage reponseObject 
=ProtoResponseMessage.parseFrom(thread.client.getInputStream());  (This 
code gets stuck ... I think it's looking for END OF FILE ... How do I send 
EOF here from ProtocolBuffer.

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to