Thread: Puzzled (sockets and console)

  1. #1
    Registered User
    Join Date
    Feb 2006

    Puzzled (sockets and console)

    Hey, at the moment, i've written a console program which currently connects to an IRC server and idles there. Here's the while loop i use:

    while (1) {
       ::WSAWaitForMultipleEvents(1, &wsaevent,FALSE, INFINITE, FALSE);
       if ((hProcessEvent.lNetworkEvents & FD_READ) &&  (hProcessEvent.iErrorCode[FD_READ_BIT] == 0)) {
       if (online) {
         // Connected to server and received data.. send it to the OnRecv() function
         } else {
    and the OnRecv() function:

    int IRCconnection::OnRecv() {
        //When incoming data detected.. do this
        string data;
        data = readline(); // Retreive line at a time
        checkreg(); // Check if registered
        checkforping(data); // See if the data received is from a ping request
    Now at this same time, I would like for there to be an interface via this console program. ie an options menu....

       1) Reload Database
       2) Change to next server
       3) Change Nickname
    Now i was just wondering, if I created a display function, would the display be useable without disturbing the IRC connection. At any time it may respond to both console and IRC input.

    IRC via triggers, e.g. !slap and console via the menu. If you could provide any code to help me create a menu that wouldnt disturb IRC functions then that would be great.


  2. #2
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    I've never used WSAWaitForMultipleEvents, but my guess is that it's always waiting, especially since you're sending him a token like INFINITE.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Making a virtual console (Linux)
    By Moddy in forum C++ Programming
    Replies: 2
    Last Post: 12-16-2005, 12:54 PM
  2. Redirecting console output to sockets
    By junbin in forum Windows Programming
    Replies: 1
    Last Post: 01-19-2003, 03:15 AM
  3. Beyond MFC : COM || Networking
    By kuphryn in forum Windows Programming
    Replies: 5
    Last Post: 04-25-2002, 04:28 PM