From de7947b829a3b5d3e1eb46a424d09a4ae645bfbe Mon Sep 17 00:00:00 2001 From: William Leong <27942257+williamleong@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:56:51 +0800 Subject: [PATCH] Fix #230 --- src/zmqpp/socket.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/zmqpp/socket.cpp b/src/zmqpp/socket.cpp index 5cb98fd..cf67495 100644 --- a/src/zmqpp/socket.cpp +++ b/src/zmqpp/socket.cpp @@ -118,13 +118,21 @@ void socket::close() bool socket::send(std::string const& str, bool dont_block/* = false */) { - return send(str, (dont_block) ? socket::dont_wait : socket::normal); + message_t msg(str); + return send(msg, (dont_block) ? socket::dont_wait : socket::normal); } bool socket::receive(std::string &str, bool dont_block /* = false */) { - // Unable to use message wrapper as this could be multipart legacy fallback - return receive(str, (dont_block) ? socket::dont_wait : socket::normal); + message msg; + + bool ret = receive(msg, (dont_block) ? socket::dont_wait : socket::normal); + if (ret) + { + msg.get(str, 0); + } + + return ret; } bool socket::send(zmqpp::signal sig, bool dont_block/* = false */)