mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-26 23:01:04 +08:00
Problem: test_hello_msg binds to hard-coded port and fails when it's in use
Solution: use the common wildcard bind pattern instead
This commit is contained in:
parent
04ecff399b
commit
2ac5ee7307
@ -36,16 +36,17 @@ void test (const char *address)
|
||||
{
|
||||
// Create a router
|
||||
void *router = test_context_socket (ZMQ_ROUTER);
|
||||
char my_endpoint[MAX_SOCKET_STRING];
|
||||
|
||||
// set router socket options
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (router, ZMQ_HELLO_MSG, "H", 1));
|
||||
|
||||
// bind router
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (router, address));
|
||||
test_bind (router, address, my_endpoint, MAX_SOCKET_STRING);
|
||||
|
||||
// Create a dealer
|
||||
void *dealer = test_context_socket (ZMQ_DEALER);
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (dealer, address));
|
||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (dealer, my_endpoint));
|
||||
|
||||
// Receive the hello message
|
||||
recv_string_expect_success (dealer, "H", 0);
|
||||
@ -57,7 +58,7 @@ void test (const char *address)
|
||||
|
||||
void test_tcp ()
|
||||
{
|
||||
test ("tcp://127.0.0.1:5569");
|
||||
test ("tcp://127.0.0.1:*");
|
||||
}
|
||||
|
||||
void test_inproc ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user