简体   繁体   中英

IRC no ident response (C++)

So, I'm making a bot to monitor my IRC channel, and I can't get it to register ident, I don't know why, here's my code

  int count = 0;
int BeginReceive() {
    do {
        initResult = recv(bobSocket, recvbuf, recvbuflen, 0);

        if (initResult > 0) {
            printf(recvbuf);
            count++;
            std::cout << count << std::endl;
            switch (count) {
            case 2:
                Send("USER jackolalno :hello");
                Send("NICK jackololno");
                break;
            case 3:
                Send("JOIN ##bob");
            default:
                break;
            }
        }
        else if (initResult == 0) {
            printf("Connection closed\n");
        }
        else {
            printf("recv failed: %d\n", WSAGetLastError());
            return 1;
        }
    } while (initResult > 0);
 }

Your USER command is missing values.

It should contain four parameters of which the second and third may simply be filled with a placeholder, eg "*". See: https://tools.ietf.org/html/rfc1459#section-4.1.3

You are also not running an ident server on port 113 most likely, but this is optional as per RFC1459.

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM