You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently protobuf is wrapping all messages in the following global type, and holding the actual message as a serialized string, forcing a second manual serialization and deserializtion of the message itself.
This (I believe) was done as a work around for the fact that the nanomsg python library attempts to decode data to be sent as ascii, and crashes on non-ascii characters (e.g. '\xff'). Some testing has shown that if we instead pass the serialized protobuf message as a list of individual characters, it will not attempt to do an ascii decode and will send the raw data correctly:
# In terminal 1>>>importnnpy>>>sock=nnpy.Socket(nnpy.AF_SP, nnpy.REQ)
>>>sock.connect("ipc:///tmp/nn_testing")
>>>s='\xff\xaa\x00 This is a \xBB\xCC test'>>>sock.send(s)
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"/usr/local/lib/python2.7/dist-packages/nnpy/socket.py", line53, insenddata=data.encode() ifisinstance(data, str) elsedataUnicodeDecodeError: 'ascii'codeccan'tdecodebyte0xffinposition0: ordinalnotinrange(128)
>>>sock.send([cforcins])
>>>
# In second terminal>>>importnnpy>>>sock=nnpy.Socket(nnpy.AF_SP, nnpy.REP)
>>>sock.bind("ipc:///tmp/nn_testing")
>>>sock.recv()
'\xff\xaa\x00 This is a \xbb\xcc test'>>>
This workaround I believe was also forcing other odd limitations such as using strings to represent boolean or integer fields.
A good amount of the debugger code could be simplified based on this, and would definitely be an improvement in the overall quality of the project.
The text was updated successfully, but these errors were encountered:
Currently protobuf is wrapping all messages in the following global type, and holding the actual message as a serialized string, forcing a second manual serialization and deserializtion of the message itself.
This (I believe) was done as a work around for the fact that the nanomsg python library attempts to decode data to be sent as ascii, and crashes on non-ascii characters (e.g.
'\xff'
). Some testing has shown that if we instead pass the serialized protobuf message as a list of individual characters, it will not attempt to do an ascii decode and will send the raw data correctly:This workaround I believe was also forcing other odd limitations such as using strings to represent boolean or integer fields.
A good amount of the debugger code could be simplified based on this, and would definitely be an improvement in the overall quality of the project.
The text was updated successfully, but these errors were encountered: