mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-15 10:18:01 +08:00
commit
29905ac56a
@ -48,7 +48,7 @@ int main (void)
|
||||
val = 0;
|
||||
rc = zmq_setsockopt(to, ZMQ_LINGER, &val, sizeof(val));
|
||||
assert (rc == 0);
|
||||
rc = zmq_bind (to, "tcp://*:6555");
|
||||
rc = zmq_bind (to, "tcp://127.0.0.1:6555");
|
||||
assert (rc == 0);
|
||||
|
||||
// Create a socket pushing to two endpoints - only 1 message should arrive.
|
||||
@ -58,10 +58,10 @@ int main (void)
|
||||
val = 0;
|
||||
zmq_setsockopt (from, ZMQ_LINGER, &val, sizeof (val));
|
||||
// This pipe will not connect
|
||||
rc = zmq_connect (from, "tcp://localhost:5556");
|
||||
rc = zmq_connect (from, "tcp://127.0.0.1:5556");
|
||||
assert (rc == 0);
|
||||
// This pipe will
|
||||
rc = zmq_connect (from, "tcp://localhost:6555");
|
||||
rc = zmq_connect (from, "tcp://127.0.0.1:6555");
|
||||
assert (rc == 0);
|
||||
|
||||
// We send 10 messages, 5 should just get stuck in the queue
|
||||
@ -107,7 +107,7 @@ int main (void)
|
||||
// Bind the valid socket
|
||||
to = zmq_socket (context, ZMQ_PULL);
|
||||
assert (to);
|
||||
rc = zmq_bind (to, "tcp://*:5560");
|
||||
rc = zmq_bind (to, "tcp://127.0.0.1:5560");
|
||||
assert (rc == 0);
|
||||
|
||||
val = 0;
|
||||
@ -128,10 +128,10 @@ int main (void)
|
||||
assert (rc == 0);
|
||||
|
||||
// Connect to the invalid socket
|
||||
rc = zmq_connect (from, "tcp://localhost:5561");
|
||||
rc = zmq_connect (from, "tcp://127.0.0.1:5561");
|
||||
assert (rc == 0);
|
||||
// Connect to the valid socket
|
||||
rc = zmq_connect (from, "tcp://localhost:5560");
|
||||
rc = zmq_connect (from, "tcp://127.0.0.1:5560");
|
||||
assert (rc == 0);
|
||||
|
||||
// Send 10 messages, all should be routed to the connected pipe
|
||||
@ -181,9 +181,9 @@ int main (void)
|
||||
int on = 1;
|
||||
rc = zmq_setsockopt (frontend, ZMQ_DELAY_ATTACH_ON_CONNECT, &on, sizeof (on));
|
||||
assert (rc == 0);
|
||||
rc = zmq_bind (backend, "tcp://*:5560");
|
||||
rc = zmq_bind (backend, "tcp://127.0.0.1:5560");
|
||||
assert (rc == 0);
|
||||
rc = zmq_connect (frontend, "tcp://localhost:5560");
|
||||
rc = zmq_connect (frontend, "tcp://127.0.0.1:5560");
|
||||
assert (rc == 0);
|
||||
|
||||
// Ping backend to frontend so we know when the connection is up
|
||||
@ -213,7 +213,7 @@ int main (void)
|
||||
assert (backend);
|
||||
rc = zmq_setsockopt (backend, ZMQ_LINGER, &zero, sizeof (zero));
|
||||
assert (rc == 0);
|
||||
rc = zmq_bind (backend, "tcp://*:5560");
|
||||
rc = zmq_bind (backend, "tcp://127.0.0.1:5560");
|
||||
assert (rc == 0);
|
||||
|
||||
// Ping backend to frontend so we know when the connection is up
|
||||
|
@ -22,7 +22,7 @@ int main(int argc, char** argv) {
|
||||
zmq_setsockopt(subSocket, ZMQ_SUBSCRIBE, "foo", 3) && printf("zmq_setsockopt: %s\n",zmq_strerror(errno));
|
||||
|
||||
zmq_bind(pubSocket, "inproc://someInProcDescriptor") && printf("zmq_bind: %s\n", zmq_strerror(errno));
|
||||
//zmq_bind(pubSocket, "tcp://*:30010") && printf("zmq_bind: %s\n", zmq_strerror(errno));
|
||||
//zmq_bind(pubSocket, "tcp://127.0.0.1:30010") && printf("zmq_bind: %s\n", zmq_strerror(errno));
|
||||
|
||||
int32_t more;
|
||||
size_t more_size = sizeof(more);
|
||||
|
Loading…
x
Reference in New Issue
Block a user