2
Copyright (c) 2009-2011 250bpm s.r.o.
3
Copyright (c) 2007-2009 iMatix Corporation
4
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
6
This file is part of 0MQ.
8
0MQ is free software; you can redistribute it and/or modify it under
9
the terms of the GNU Lesser General Public License as published by
10
the Free Software Foundation; either version 3 of the License, or
11
(at your option) any later version.
13
0MQ is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU Lesser General Public License for more details.
18
You should have received a copy of the GNU Lesser General Public License
19
along with this program. If not, see <http://www.gnu.org/licenses/>.
22
#include "../include/zmq.h"
23
#include "../include/zmq_utils.h"
28
int main (int argc, char *argv [])
30
const char *connect_to;
40
printf ("usage: remote_thr <connect-to> <message-size> "
44
connect_to = argv [1];
45
message_size = atoi (argv [2]);
46
message_count = atoi (argv [3]);
50
printf ("error in zmq_init: %s\n", zmq_strerror (errno));
54
s = zmq_socket (ctx, ZMQ_PUSH);
56
printf ("error in zmq_socket: %s\n", zmq_strerror (errno));
60
// Add your socket options here.
61
// For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.
63
rc = zmq_connect (s, connect_to);
65
printf ("error in zmq_connect: %s\n", zmq_strerror (errno));
69
for (i = 0; i != message_count; i++) {
71
rc = zmq_msg_init_size (&msg, message_size);
73
printf ("error in zmq_msg_init_size: %s\n", zmq_strerror (errno));
76
#if defined ZMQ_MAKE_VALGRIND_HAPPY
77
memset (zmq_msg_data (&msg), 0, message_size);
80
rc = zmq_sendmsg (s, &msg, 0);
82
printf ("error in zmq_sendmsg: %s\n", zmq_strerror (errno));
85
rc = zmq_msg_close (&msg);
87
printf ("error in zmq_msg_close: %s\n", zmq_strerror (errno));
94
printf ("error in zmq_close: %s\n", zmq_strerror (errno));
100
printf ("error in zmq_term: %s\n", zmq_strerror (errno));