Skip to contentSkip to conversation

question on socket connection

DISCUSSION Lejanson C. Go 3 participants 3 messages May 26, 2003

lore
Share & tools
lore
#1 lore raw

readSet = socketSet;
if ( select( highestSocketValue + 1, &readSet, NULL, NULL, NULL ) > -1 )

 {
     .
     .
     .
     
     if ( FD_ISSET( mySocket, &readSet ) )
     {
       size = recv( mySocket, message, MAX_MSG_SIZE - 1, 0 );
       if ( size == 0 )
       {
          close( mySocket );
          FD_CLR( mySocket, &socketSet );
       }
       else
       {
          printf( "%s\n", message );
       }
     }
     
     .
     .
     .

}