mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-20 14:02:41 +02:00
Test for 127.0.0.1 at tests startup
This commit is contained in:
@@ -30,14 +30,12 @@
|
|||||||
|
|
||||||
#if defined (ZMQ_HAVE_WINDOWS)
|
#if defined (ZMQ_HAVE_WINDOWS)
|
||||||
|
|
||||||
void initialise_network()
|
void initialise_network (void)
|
||||||
{
|
{
|
||||||
WSADATA info;
|
WSADATA info;
|
||||||
if (WSAStartup(MAKEWORD(2,0), &info) != 0)
|
if (WSAStartup(MAKEWORD(2,0), &info) != 0)
|
||||||
{
|
|
||||||
throw std::runtime_error("Could not start WSA");
|
throw std::runtime_error("Could not start WSA");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int close (int fd)
|
int close (int fd)
|
||||||
{
|
{
|
||||||
@@ -46,20 +44,29 @@ int close(int fd)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void initialise_network()
|
void initialise_network (void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This test case stresses the system to shake out known configuration
|
// This test case stresses the system to shake out known configuration
|
||||||
// problems. We're not using libzmq here but direct system calls. Note
|
// problems. We're direct system calls when necessary. Some code may
|
||||||
// that code may need wrapping to be properly portable.
|
// need wrapping to be properly portable.
|
||||||
|
|
||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
initialise_network ();
|
initialise_network ();
|
||||||
|
|
||||||
|
// Check that we have local networking via ZeroMQ
|
||||||
|
void *ctx = zmq_ctx_new ();
|
||||||
|
assert (ctx);
|
||||||
|
void *dealer = zmq_socket (ctx, ZMQ_DEALER);
|
||||||
|
if (zmq_bind (dealer, "tcp://127.0.0.1:5670") == -1) {
|
||||||
|
printf ("E: Cannot find 127.0.0.1 -- your system does not have local\n");
|
||||||
|
printf ("E: networking. Please fix this before running libzmq checks.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
// Check that we can create 1,000 sockets
|
// Check that we can create 1,000 sockets
|
||||||
int handle [1000];
|
int handle [1000];
|
||||||
int count;
|
int count;
|
||||||
|
Reference in New Issue
Block a user