Home   Archive   Permalink



News from: R2 to R3 TCP bridge - how to pass a bytes array?

From Ren-C (compliled with OMQ extension) - using the current 0MQ version 4.2.5 - I was able to receive messages from R2 using the TCP chat example: http://www.rebol.net/cookbook/recipes/0028.html
    
I use ZMQ_STREAM "pairing" which behaves like a standard BSD socket according to: http://hintjens.com/blog:42
    
When sending a message from R3 to R2,
    
zmq-send socket msg
    
I get the following error
    
     ; zmq-send does not allow binary! for its msg argument
     ; zmq-send does not allow block! for its msg argument
     ; zmq-send does not allow text! for its msg argument
    
According to 0MQ doc
    
[...] zmq_send() and zmq_recv(), to which you pass byte arrays, not message structures.
    
Isn't msg in
    
msg: to-binary "Test"
    
a binary array address?
    
zmq-send: 'make action! [[socket msg /dontwait /sndmore] [...]]
    
Thanks
    


posted by:   VIDpuzzle     21-Mar-2019/14:24:21-7:00



I will only give very short answers here. e.g. "look in the examples/ dir for S-SEND".
    
Those files originated from @earl's extension. Here were the originals:
    
https://github.com/earl/r3-zmq/blob/3a7c2af0972fecbc6eda446ed22117b826a0c35d/examples/helpers.r3#L28
    
For longer discussion of why he may have made various choices, or to discuss the design of the extension in general, start a thread here:
    
https://forum.rebol.info/c/development/modules

posted by:   Fork     21-Mar-2019/16:03:42-7:00



Thanks for inquiring and for pointing me back to the original example.
    
The R2 chat messaging example uses two different ports, port/locate-port to initiate the connection and message the client, port/remote-port to receive messages from the client.
    
I have yet to use a R2 port for two-way messaging as a standard BSD socket, Ren-C to send messages from the remote-port acting as R2 client.
    
The remote-port changes every time a new server instance is launched. I wonder how the client gets the port/remote-port number as all I receive is a 0 length message followed by a routing_ID message.
    
    
    


posted by:   VIDpuzzle     24-Mar-2019/13:33:34-7:00