methodmissing / rbczmq

Ruby extension that wraps the official high level ZeroMQ C API ( http://czmq.zeromq.org/ )
http://github.com/methodmissing/rbczmq
MIT License
125 stars 32 forks source link

Cannot subscribe to Publisher with NUL characters in the filter #62

Open ghost opened 8 years ago

ghost commented 8 years ago

When using the following code:

ctx = ZMQ::Context.new
sub = ctx.socket(:SUB)
sub.connect('tcp://127.0.0.1:5680')
filter = [1, 1000].pack('CQ>')
sub.subscribe(filter)

the filter string is "\x01\x00\x00\x00\x00\x00\x00\x03\xE8" and the call to subscribe raises an exception with the following message:

string contains null byte

Using the exact same string with the C++ bindings works correctly, which suggests that the gem does something wrong.