aboutsummaryrefslogtreecommitdiff
path: root/src/stable/tcpserversocket.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-08-28 17:42:54 +0000
committerMike Buland <eichlan@xagasoft.com>2012-08-28 17:42:54 +0000
commit411cdf39fc2b961a970a0ae91b9059614251247e (patch)
tree935afa56c11aef0fb769e63659970e7d033a99e8 /src/stable/tcpserversocket.cpp
parentfc5132d68ae9e6afdbd0b5a687ba81c88fc84826 (diff)
downloadlibbu++-411cdf39fc2b961a970a0ae91b9059614251247e.tar.gz
libbu++-411cdf39fc2b961a970a0ae91b9059614251247e.tar.bz2
libbu++-411cdf39fc2b961a970a0ae91b9059614251247e.tar.xz
libbu++-411cdf39fc2b961a970a0ae91b9059614251247e.zip
Loads of win32 compilation issues fixed. Most are fairly minor unsigned/signed
mismatches because of socket handles, but there were also some order-of-definition issues that were fixed in the FD_SETSIZE definition code. Fixed a few things that just never worked on windows, like Bu::Thread::yield().
Diffstat (limited to 'src/stable/tcpserversocket.cpp')
-rw-r--r--src/stable/tcpserversocket.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/stable/tcpserversocket.cpp b/src/stable/tcpserversocket.cpp
index daedcd1..91da199 100644
--- a/src/stable/tcpserversocket.cpp
+++ b/src/stable/tcpserversocket.cpp
@@ -5,6 +5,8 @@
5 * terms of the license contained in the file LICENSE. 5 * terms of the license contained in the file LICENSE.
6 */ 6 */
7 7
8#include "bu/config.h"
9
8#ifndef WIN32 10#ifndef WIN32
9 #include <sys/socket.h> 11 #include <sys/socket.h>
10 #include <netinet/in.h> 12 #include <netinet/in.h>
@@ -23,8 +25,6 @@
23#include <fcntl.h> 25#include <fcntl.h>
24#include "bu/tcpserversocket.h" 26#include "bu/tcpserversocket.h"
25 27
26#include "bu/config.h"
27
28namespace Bu { subExceptionDef( TcpServerSocketException ) } 28namespace Bu { subExceptionDef( TcpServerSocketException ) }
29 29
30Bu::TcpServerSocket::TcpServerSocket( int nPort, int nPoolSize ) : 30Bu::TcpServerSocket::TcpServerSocket( int nPort, int nPoolSize ) :
@@ -72,7 +72,7 @@ Bu::TcpServerSocket::TcpServerSocket(const String &sAddr,int nPort, int nPoolSiz
72 startServer( name, nPoolSize ); 72 startServer( name, nPoolSize );
73} 73}
74 74
75Bu::TcpServerSocket::TcpServerSocket( int nServer, bool bInit, int nPoolSize ) : 75Bu::TcpServerSocket::TcpServerSocket( socket_t nServer, bool bInit, int nPoolSize ) :
76 nServer( nServer ), 76 nServer( nServer ),
77 nPort( 0 ) 77 nPort( 0 )
78{ 78{
@@ -109,7 +109,11 @@ Bu::TcpServerSocket::TcpServerSocket( const TcpServerSocket &rSrc )
109 109
110Bu::TcpServerSocket::~TcpServerSocket() 110Bu::TcpServerSocket::~TcpServerSocket()
111{ 111{
112#ifdef WIN32
113 if( nServer != INVALID_SOCKET )
114#else
112 if( nServer > -1 ) 115 if( nServer > -1 )
116#endif
113 ::close( nServer ); 117 ::close( nServer );
114} 118}
115 119
@@ -118,7 +122,11 @@ void Bu::TcpServerSocket::startServer( struct sockaddr_in &name, int nPoolSize )
118 /* Create the socket. */ 122 /* Create the socket. */
119 nServer = bu_socket( PF_INET, SOCK_STREAM, 0 ); 123 nServer = bu_socket( PF_INET, SOCK_STREAM, 0 );
120 124
125#ifdef WIN32
126 if( nServer == INVALID_SOCKET )
127#else
121 if( nServer < 0 ) 128 if( nServer < 0 )
129#endif
122 { 130 {
123 throw Bu::TcpServerSocketException("Couldn't create a listen socket."); 131 throw Bu::TcpServerSocketException("Couldn't create a listen socket.");
124 } 132 }