Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added multipart envelope support #59

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/ZMQ.jl
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,13 @@ function send(socket::Socket, zmsg::Message, flag=int32(0))
throw(StateError(jl_zmq_error_str()))
end
end

function send_multipart(socket::Socket, parts::Array{Message})
for msg in parts[1:end-1]
send(socket, msg, SNDMORE)
end
return send(socket, parts[end])
end
end # end v3only

# strings are immutable, so we can send them zero-copy by default
Expand Down Expand Up @@ -558,6 +565,15 @@ function recv(socket::Socket)
end
return zmsg
end

function recv_multipart(socket::Socket)
parts = Any[recv(socket)]
while ismore(socket)
push!(parts, recv(socket))
end

return parts
end
end # end v3only

## Constants
Expand Down