Of course my professor forces me to create a program using the worst network API ever made! lol.

Anyway, on to my questions:

I am creating a console program that will act as a server for a game. The thing is, when I call IDirectPlay8Peer->Host, it returns immediately and the program exits. To explain further, here is a rough outline of my program. Please keep in mine I'm using Peer to Peer networking:

Code:
int main(void)
{
    // Initialize COM

    // Create DirectPlay8Peer Object

    // Create DirectPlay8Address Objects

    // Configure Addresses

    // Configure player info (to add ourselves to the game)

    // Host game by calling IDirectPlay8Peer->Host()

    system("pause");
    return 0;
}
Do you see the problem? See, when you host a peer to peer session, you initiate a message handler that intercepts all of the IDirectPlay8 messages. The program needs to continue handling these messages until it is somehow instructed to close, either by a remote disconnection or by the user closing the console window.

As soon as the host() function is called, it returns... causing the program to return after the user presses 'any key'.

I need a way to make the main() function not return (therefore terminating the program) after the host function is called, but I don't want to hender the program from handling DirectPlay networking messages.

Any ideas?