Windows build fixed

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
Martin Sustrik 2011-08-18 17:58:46 +02:00
parent b6ecb00d23
commit 898ee99dc1
3 changed files with 21 additions and 2 deletions

View File

@ -422,6 +422,10 @@
RelativePath="..\..\..\src\sub.cpp" RelativePath="..\..\..\src\sub.cpp"
> >
</File> </File>
<File
RelativePath="..\..\..\src\tcp_address.cpp"
>
</File>
<File <File
RelativePath="..\..\..\src\tcp_connecter.cpp" RelativePath="..\..\..\src\tcp_connecter.cpp"
> >
@ -704,6 +708,10 @@
RelativePath="..\..\..\src\sub.hpp" RelativePath="..\..\..\src\sub.hpp"
> >
</File> </File>
<File
RelativePath="..\..\..\src\tcp_address.hpp"
>
</File>
<File <File
RelativePath="..\..\..\src\tcp_connecter.hpp" RelativePath="..\..\..\src\tcp_connecter.hpp"
> >

View File

@ -23,15 +23,14 @@
#include "tcp_address.hpp" #include "tcp_address.hpp"
#include "platform.hpp" #include "platform.hpp"
#include "stdint.hpp"
#include "err.hpp" #include "err.hpp"
#ifdef ZMQ_HAVE_WINDOWS #ifdef ZMQ_HAVE_WINDOWS
#include "windows.hpp" #include "windows.hpp"
#else #else
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <netdb.h> #include <netdb.h>
#endif #endif
@ -415,7 +414,11 @@ socklen_t zmq::tcp_address_t::addrlen ()
return (socklen_t) sizeof (address.ipv4); return (socklen_t) sizeof (address.ipv4);
} }
#if defined ZMQ_HAVE_WINDOWS
unsigned short zmq::tcp_address_t::family ()
#else
sa_family_t zmq::tcp_address_t::family () sa_family_t zmq::tcp_address_t::family ()
#endif
{ {
return address.generic.sa_family; return address.generic.sa_family;
} }

View File

@ -23,8 +23,12 @@
#include "platform.hpp" #include "platform.hpp"
#if defined ZMQ_HAVE_WINDOWS
#include "windows.hpp"
#else
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#endif
namespace zmq namespace zmq
{ {
@ -42,7 +46,11 @@ namespace zmq
// If 'ipv4only' is true, the name will never resolve to IPv6 address. // If 'ipv4only' is true, the name will never resolve to IPv6 address.
int resolve (const char* name_, bool local_, bool ipv4only_); int resolve (const char* name_, bool local_, bool ipv4only_);
#if defined ZMQ_HAVE_WINDOWS
unsigned short family ();
#else
sa_family_t family (); sa_family_t family ();
#endif
sockaddr *addr (); sockaddr *addr ();
socklen_t addrlen (); socklen_t addrlen ();