Original Post
Hi everyone ! I want to know if someone could explain me how to use the function select( ) ( in winsock ) because I have read a tutorial and I really don't understand how to use it. I have tried this code that I wrote and my ErrorMessage( ) function outputs "Invalid Argument" Here's the code:
void Server::MainLoop( )
{
for( ;; )
{
if( select( NULL, &Read, NULL, NULL, NULL ) == SOCKET_ERROR )
{
ErrorMessage( WSAGetLastError( ) ) ;
exit( 0 ) ;
}
cout << "Ok!\n" ;
}
}
Big thanks to everyone. PS: I have tried to add a timeval in the function too ( as suggested by someone on another forum ) but it didn't work neither.