iperf Server::Run() 去掉UDP部分

99 void Server::Run( void ) {
100     long currLen;
101     max_size_t totLen = 0;
102     struct UDP_datagram* mBuf_UDP  = (struct UDP_datagram*) mBuf;
103 
104     ReportStruct *reportstruct = NULL;
105 
106     reportstruct = new ReportStruct;
107     if ( reportstruct != NULL ) {
108         reportstruct->packetID = 0;
109         mSettings->reporthdr = InitReport( mSettings );
110         do {
111             // perform read 
112             currLen = recv( mSettings->mSock, mBuf, mSettings->mBufLen, 0 );
            totLen += currLen;
142         } while ( currLen > 0 );

145         // stop timing 
146         gettimeofday( &(reportstruct->packetTime), NULL );
147 
148     if ( !isUDP (mSettings)) {
149         if(0.0 == mSettings->mInterval) {
150                         reportstruct->packetLen = totLen;
151                 }
152         ReportPacket( mSettings->reporthdr, reportstruct );
153     }
154         CloseReport( mSettings->reporthdr, reportstruct );
160         }
161     } else {
162         FAIL(1, "Out of memory! Closing server thread
", mSettings);
163     }
164 
165     Mutex_Lock( &clients_mutex );
166     Iperf_delete( &(mSettings->peer), &clients );
167     Mutex_Unlock( &clients_mutex );
168 
169     DELETE_PTR( reportstruct );
170     EndReport( mSettings->reporthdr );
171 }
原文地址:https://www.cnblogs.com/zengtx/p/8385521.html