@MigthyMax
I figured it out by myself. If somebody wants to know how to do it. You can actually use ISocket->WaitSelect for implemneting a simple server like this (simplified, no error checking etc):
ISocket->bind( socket,(struct sockaddr *)&addr,sizeof(addr) );
ISocket->listen( socket,1 )
for( int loop = TRUE;loop; ) {
fd_set listenFds;
FD_ZERO( &listenFds );
FD_SET( socket,&listenFds );
printf("Listening.....\n");
ULONG signals = SIGBREAKF_CTRL_C;
int readyDescriptors = ISocket->WaitSelect( socket +1,&listenFds,NULL,NULL,NULL,&signals );
if( readyDescriptors == -1 ) {
printf( "Network Error.\n" );
loop = FALSE;
}
else {
if( ( signals & SIGBREAKF_CTRL_C ) == SIGBREAKF_CTRL_C ) {
printf( "Detected CTRL-C.\n" );
loop = FALSE;
}
if( FD_ISSET( socket,&listenFds ) ) {
int client = ISocket->accept( socket,NULL,NULL );
if( client != -1 ) {
printf("Client connected.\n");
ISocket->CloseSocket( client );
}
}
}
}