Commit 5a8b46e3 authored by Min RK's avatar Min RK

allow vanilla socket security tests to run on Windows

- add ws2tcpip.h
- alias close->closesocket
- increment port in sec_null test
parent efed3d01
...@@ -20,7 +20,9 @@ ...@@ -20,7 +20,9 @@
#include "testutil.hpp" #include "testutil.hpp"
#if defined (ZMQ_HAVE_WINDOWS) #if defined (ZMQ_HAVE_WINDOWS)
# include <winsock2.h> # include <winsock2.h>
# include <ws2tcpip.h>
# include <stdexcept> # include <stdexcept>
# define close closesocket
#else #else
# include <sys/socket.h> # include <sys/socket.h>
# include <netinet/in.h> # include <netinet/in.h>
......
...@@ -20,7 +20,9 @@ ...@@ -20,7 +20,9 @@
#include "testutil.hpp" #include "testutil.hpp"
#if defined (ZMQ_HAVE_WINDOWS) #if defined (ZMQ_HAVE_WINDOWS)
# include <winsock2.h> # include <winsock2.h>
# include <ws2tcpip.h>
# include <stdexcept> # include <stdexcept>
# define close closesocket
#else #else
# include <sys/socket.h> # include <sys/socket.h>
# include <netinet/in.h> # include <netinet/in.h>
...@@ -138,14 +140,14 @@ int main (void) ...@@ -138,14 +140,14 @@ int main (void)
assert (server); assert (server);
rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "WRONG", 5); rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "WRONG", 5);
assert (rc == 0); assert (rc == 0);
rc = zmq_bind (server, "tcp://127.0.0.1:9002"); rc = zmq_bind (server, "tcp://127.0.0.1:9003");
assert (rc == 0); assert (rc == 0);
struct sockaddr_in ip4addr; struct sockaddr_in ip4addr;
int s; int s;
ip4addr.sin_family = AF_INET; ip4addr.sin_family = AF_INET;
ip4addr.sin_port = htons(9002); ip4addr.sin_port = htons(9003);
inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr); inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr);
s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
......
...@@ -20,7 +20,9 @@ ...@@ -20,7 +20,9 @@
#include "testutil.hpp" #include "testutil.hpp"
#if defined (ZMQ_HAVE_WINDOWS) #if defined (ZMQ_HAVE_WINDOWS)
# include <winsock2.h> # include <winsock2.h>
# include <ws2tcpip.h>
# include <stdexcept> # include <stdexcept>
# define close closesocket
#else #else
# include <sys/socket.h> # include <sys/socket.h>
# include <netinet/in.h> # include <netinet/in.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment