Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6122953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:57:33+00:00 2026-05-23T15:57:33+00:00

Error occurs during JOIN and USER, it tells me I need to "Register first".

  • 0

Error occurs during JOIN and USER, it tells me I need to "Register first". The three: PASS, NICK work correctly (probably). Any idea how is this possible? I’ve followed the relevant RFC, https://www.rfc-editor.org/rfc/rfc1459#section-4.1

code:

#include <iostream>
#include <winsock2.h>
#include <string>
#include <cstring>
#include <fstream>

#pragma comment(lib, "ws2_32.lib")

using namespace std;
unsigned long resolveHost(const string &host){
    LPHOSTENT entryHost = gethostbyname(host.c_str());

    if(!entryHost){
        unsigned int addr = inet_addr(host.c_str());
        entryHost = gethostbyaddr((char*)&addr, 4, AF_INET);
        if(!entryHost)  return 0;
    }
    return *((int*)*entryHost->h_addr_list);
}

int main(){
    WSADATA         wsaData;
    SOCKADDR_IN     saddr;
    SOCKET          sock;
    char            buffer[1024*8] = {"0"};
    string          adres_hosta = "irc.example.com";
    string          sbuffer;
    string          nick = "johnsmith";
    string          kanal = "#channel";
    string          password = "p@55w0rd";
    string          auth = "/AuthServ auth johnsmith p@55w0rd";
    WSAStartup(MAKEWORD(2, 2), &wsaData);
    sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    saddr.sin_addr.S_un.S_addr = resolveHost(adres_hosta);
    saddr.sin_port =  htons(6667);
    saddr.sin_family = AF_INET;
    if(connect(sock, (sockaddr*)&saddr, sizeof(sockaddr)) == SOCKET_ERROR){
        cout << "Nie udalo sie nawiazac polaczenia z " << adres_hosta << ".";
        return 0;
    }
    recv(sock, buffer, 1024*8, 0);
    cout << buffer << endl << endl << flush;
    /*
           1. Pass message
           2. Nick message
           3. User message
    */
    sbuffer ="PASS " + password + "\r\n";
    send(sock, sbuffer.c_str(), strlen(sbuffer.c_str()), 0);
    recv(sock, buffer, 1024*8, 0);
    cout << sbuffer.c_str() << endl << buffer << endl << endl;

    sbuffer = "NICK " + nick + "\r\n";
    send(sock, sbuffer.c_str(), strlen(sbuffer.c_str()), 0);
    recv(sock, buffer, 1024*8, 0);
    cout << sbuffer.c_str() << endl << buffer << endl << endl;

    sbuffer = "USER " + nick + " " + adres_hosta + " " + nick + " :" + nick + "\r\n";
    send(sock, sbuffer.c_str(), strlen(sbuffer.c_str()), 0);
    recv(sock, buffer, 1024*8, 0);
    cout << sbuffer.c_str() << endl << buffer << endl << endl;

    sbuffer = "JOIN " + kanal + "\r\n";
    send(sock, sbuffer.c_str(), strlen(sbuffer.c_str()), 0);
    recv(sock, buffer, 1024*8, 0);
    cout << sbuffer.c_str() << endl << buffer << endl << endl;

    while(true){
        recv(sock, buffer, 1024*8, 0);
        cout << buffer << endl << endl;
        if(buffer[0] == 'PING'){
            sbuffer = "PONG :" + adres_hosta + "\r\n";
            send(sock, sbuffer.c_str(), strlen(sbuffer.c_str()), 0);
            cout << sbuffer.c_str() << endl << buffer << endl << endl;
        }
    }
    return 1;
}

logs with connection :

NOTICE AUTH :*** Looking up your hostname


PASS p@55w0rd

NOTICE AUTH :*** Checking Ident
NOTICE AUTH :*** Found your hostname


NICK johnsmith

PING :229860947
Checking Ident
NOTICE AUTH :*** Found your hostname


USER johnsmith johnSmith test :johnSmith

NOTICE AUTH :*** No ident response
ICE AUTH :*** Found your hostname


JOIN #channel

:server.example.com 451 johnSmith johnSmith :Register first.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:57:34+00:00Added an answer on May 23, 2026 at 3:57 pm

    I’m guessing that, to join that specific channel, your nickname must be registered with NickServ or equivalent IRC services. You’ll probably have to register the nickname you’re using with NickServ (I suggest using a regular IRC client to do this to make it easier) and then, from your code, PRIVMSG NickServ with some sort of auth command to “log in” before it will allow you to join that channel. There’s probably a channel mode that controls whether non-authorized users are allowed to join.

    If you aren’t already, I would suggest using an empty, unregistered channel for doing your testing. It helps to be able to control the test environment, and you don’t have curious people trying to break your software while you’re in the middle of developing it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make sure that if any error occurs during the database processing
I wrote my own HandleError attribute. When an error occurs during an ajax request
I have the following classes. An error occurs during the for loop in the
I found out that the error occurs during initialization Error: Providing value for System.Windows.Baml2006.TypeConverterMerkupExtension
Thanks for helping. The errors occurs during implementation accepts_nested_attributes_for . I get ActionView::Template:Error (undefined
Using Icefaces 2, if an error occurs during execution of an action method on
I'm using EF 4.1. Whenever an error occurs during the execution of a DbContext
How can I make the following code work? During compilation I get an error
What will happen if an error occurs during: Declaring a cursor Fetching data What
The error occurs when I try to do this friend std::ostream& operator<<(std::ostream& os, const

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.