mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-23 16:48:08 +02:00
Some DNSs will resolve ANY domain name so I made more reliable errors.
This commit is contained in:
@@ -30,18 +30,24 @@ int main (void)
|
|||||||
void *ctx = zmq_ctx_new ();
|
void *ctx = zmq_ctx_new ();
|
||||||
assert (ctx);
|
assert (ctx);
|
||||||
|
|
||||||
// Create pair of socket, each with high watermark of 2. Thus the total
|
|
||||||
// buffer space should be 4 messages.
|
|
||||||
void *sock = zmq_socket (ctx, ZMQ_PUB);
|
void *sock = zmq_socket (ctx, ZMQ_PUB);
|
||||||
assert (sock);
|
assert (sock);
|
||||||
|
|
||||||
int rc = zmq_connect (sock, "tcp://localhost:1234");
|
int rc = zmq_connect (sock, "tcp://localhost:1234");
|
||||||
assert (rc == 0);
|
assert (rc == 0);
|
||||||
|
|
||||||
rc = zmq_connect (sock, "tcp://0mq.is.teh.best:1234");
|
rc = zmq_connect (sock, "tcp://localhost:invalid");
|
||||||
assert (rc == -1);
|
assert (rc == -1);
|
||||||
assert (errno == EINVAL);
|
assert (errno == EINVAL);
|
||||||
|
|
||||||
|
rc = zmq_connect (sock, "tcp://in val id:1234");
|
||||||
|
assert (rc == -1);
|
||||||
|
assert (errno == EINVAL);
|
||||||
|
|
||||||
|
rc = zmq_connect (sock, "invalid://localhost:1234");
|
||||||
|
assert (rc == -1);
|
||||||
|
assert (errno == EPROTONOSUPPORT);
|
||||||
|
|
||||||
rc = zmq_close (sock);
|
rc = zmq_close (sock);
|
||||||
assert (rc == 0);
|
assert (rc == 0);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user