mirror of
https://github.com/zeromq/cppzmq.git
synced 2024-12-12 18:40:28 +01:00
Send and recv with plain buffer as an argument added
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
parent
f5bc62f8c3
commit
ac1ba21f13
20
zmq.hpp
20
zmq.hpp
@ -264,6 +264,16 @@ namespace zmq
|
||||
throw error_t ();
|
||||
}
|
||||
|
||||
inline size_t send (const void *buf_, size_t len_, int flags_ = 0)
|
||||
{
|
||||
int nbytes = zmq_send (ptr, buf_, len_, flags_);
|
||||
if (nbytes >= 0)
|
||||
return (size_t) nbytes;
|
||||
if (zmq_errno () == EAGAIN)
|
||||
return 0;
|
||||
throw error_t ();
|
||||
}
|
||||
|
||||
inline bool send (message_t &msg_, int flags_ = 0)
|
||||
{
|
||||
int nbytes = zmq_sendmsg (ptr, &(msg_.msg), flags_);
|
||||
@ -274,6 +284,16 @@ namespace zmq
|
||||
throw error_t ();
|
||||
}
|
||||
|
||||
inline size_t recv (void *buf_, size_t len_, int flags_ = 0)
|
||||
{
|
||||
int nbytes = zmq_recv (ptr, buf_, len_, flags_);
|
||||
if (nbytes >= 0)
|
||||
return (size_t) nbytes;
|
||||
if (zmq_errno () == EAGAIN)
|
||||
return 0;
|
||||
throw error_t ();
|
||||
}
|
||||
|
||||
inline bool recv (message_t *msg_, int flags_ = 0)
|
||||
{
|
||||
int nbytes = zmq_recvmsg (ptr, &(msg_->msg), flags_);
|
||||
|
Loading…
Reference in New Issue
Block a user