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
Pardon if this is a ridiculous question, I am new to passing data around, but I didn't see any examples or documentation regarding the technique for sending various types of data.
For julia, is the process always to just accept the generic message then convert it to an IO stream then to the final format? I got the following to work for passing a basic string, and was wondering if the process would be the same/similar for different data structures being passed around?
server:
using ZMQ
ctx=Context(1)
s1=Socket(ctx, REP)
ZMQ.bind(s1, "tcp://127.0.0.1:5555")
println("listening....")
whiletrue
msg = ZMQ.recv(s1)
print("GOT", msg) # should print "test request" in Uint8
ZMQ.send(s1, Message("test response"))
end
client
using ZMQ
ctx=Context(1)
s2=Socket(ctx, REQ)
ZMQ.connect(s2, "tcp://127.0.0.1:5555")
ZMQ.send(s2, Message("test request"))
msgin = ZMQ.recv(s2)
out =convert(IOStream, msgin)
@show msgin
string =takebuf_string(out))
However, if I instead wanted to send a json object to perform a calculation on, as example in zmq with python to send a json array of numbers and returned the summed values I would do the following
You can convert directly to a string with bytestring (assuming UTF8-encoded data); you don't need to convert it to a stream. See e.g. how IJulia receives IPython messages.
Pardon if this is a ridiculous question, I am new to passing data around, but I didn't see any examples or documentation regarding the technique for sending various types of data.
For julia, is the process always to just accept the generic message then convert it to an IO stream then to the final format? I got the following to work for passing a basic string, and was wondering if the process would be the same/similar for different data structures being passed around?
server:
client
However, if I instead wanted to send a json object to perform a calculation on, as example in zmq with python to send a json array of numbers and returned the summed values I would do the following
server:
client:
Can someone advise (even via pseudocode) how this would be accomplished via julia?
Thanks!
The text was updated successfully, but these errors were encountered: