]> sjero.net Git - iperf/blobdiff - src/Listener.cpp
Remove Win32 Support
[iperf] / src / Listener.cpp
index 94e32de85e48734b1471bbbf63d0ff060b0119a7..cf3c1596c790cbd03c659e7ca19ff3c7ca4585ea 100644 (file)
@@ -118,11 +118,6 @@ Listener::~Listener() {
  *          spawn a new Server thread. 
  * ------------------------------------------------------------------- */ 
 void Listener::Run( void ) {
-#ifdef WIN32
-    if ( isUDP( mSettings ) && !isSingleUDP( mSettings ) ) {
-        UDPSingleServer();
-    } else
-#else
 #ifdef sun
     if ( ( isUDP( mSettings ) && 
            isMulticast( mSettings ) && 
@@ -134,7 +129,6 @@ void Listener::Run( void ) {
     if ( isSingleUDP( mSettings ) ) {
         UDPSingleServer();
     } else
-#endif
 #endif
     {
         bool client = false, UDP = isUDP( mSettings ), mCount = (mSettings->mThreads != 0);
@@ -248,18 +242,6 @@ void Listener::Run( void ) {
             }
     
             // Start the server
-#if defined(WIN32) && defined(HAVE_THREAD)
-            if ( UDP ) {
-                // WIN32 does bad UDP handling so run single threaded
-                if ( server->runNow != NULL ) {
-                    thread_start( server->runNow );
-                }
-                server_spawn( server );
-                if ( server->runNext != NULL ) {
-                    thread_start( server->runNext );
-                }
-            } else
-#endif
             thread_start( server );
     
             // create a new socket
@@ -303,18 +285,8 @@ void Listener::Listen( ) {
 #endif
                   : AF_INET);
 
-#ifdef WIN32
-    if ( SockAddr_isMulticast( &mSettings->local ) ) {
-        // Multicast on Win32 requires special handling
-        mSettings->mSock = WSASocket( domain, type, 0, 0, 0, WSA_FLAG_MULTIPOINT_C_LEAF | WSA_FLAG_MULTIPOINT_D_LEAF );
-        WARN_errno( mSettings->mSock == INVALID_SOCKET, "socket" );
-
-    } else
-#endif
-    {
-        mSettings->mSock = socket( domain, type, 0 );
-        WARN_errno( mSettings->mSock == INVALID_SOCKET, "socket" );
-    } 
+    mSettings->mSock = socket( domain, type, 0 );
+    WARN_errno( mSettings->mSock == INVALID_SOCKET, "socket" );
 
     SetSocketOptions( mSettings );
 
@@ -324,17 +296,9 @@ void Listener::Listen( ) {
     setsockopt( mSettings->mSock, SOL_SOCKET, SO_REUSEADDR, (char*) &boolean, len );
 
     // bind socket to server address
-#ifdef WIN32
-    if ( SockAddr_isMulticast( &mSettings->local ) ) {
-        // Multicast on Win32 requires special handling
-        rc = WSAJoinLeaf( mSettings->mSock, (sockaddr*) &mSettings->local, mSettings->size_local,0,0,0,0,JL_BOTH);
-        WARN_errno( rc == SOCKET_ERROR, "WSAJoinLeaf (aka bind)" );
-    } else
-#endif
-    {
-        rc = bind( mSettings->mSock, (sockaddr*) &mSettings->local, mSettings->size_local );
-        WARN_errno( rc == SOCKET_ERROR, "bind" );
-    }
+    rc = bind( mSettings->mSock, (sockaddr*) &mSettings->local, mSettings->size_local );
+    WARN_errno( rc == SOCKET_ERROR, "bind" );
+
     // listen for connections (TCP only).
     // default backlog traditionally 5
     if ( !isUDP( mSettings ) ) {
@@ -342,12 +306,10 @@ void Listener::Listen( ) {
         WARN_errno( rc == SOCKET_ERROR, "listen" );
     }
 
-#ifndef WIN32
     // if multicast, join the group
     if ( SockAddr_isMulticast( &mSettings->local ) ) {
         McastJoin( );
     }
-#endif
 } // end Listen
 
 /* -------------------------------------------------------------------
@@ -675,7 +637,6 @@ void Listener::UDPSingleServer( ) {
  * --------------------------------------------------------------------*/ 
 
 void Listener::runAsDaemon(const char *pname, int facility) {
-#ifndef WIN32 
     pid_t pid; 
 
     /* Create a child process & if successful, exit from the parent process */ 
@@ -708,9 +669,5 @@ void Listener::runAsDaemon(const char *pname, int facility) {
     fflush(stderr); 
 
     fclose(stdin); 
-#else 
-    fprintf( stderr, "Use the precompiled windows version for service (daemon) option\n"); 
-#endif  
-
 }