열렬히.뛰기

irc 프로토콜 정리 (1)

école 42 > ft_irc (server) > 소켓과제 : 아이디어 > irc 프로토콜 정리 (1)

메시지 형식

bash
'prefix' 'command' 'params' 'CRLF'

공백(space) 단위로 자른다.

  • prefix : 서버 → 클라이언트에만 들어간다.
  • command : 명령
  • params : 필요에 따라 여러 개일 수 있다.

요청메시지 예시

shell
NICK MyNickName

USER MyUsername 0 * :My Real Name

JOIN #example_channel

PRIVMSG #example_channel :Hello, everyone!

QUIT :Leaving the chat

응답 메시지 예시

  1. RPL_WELCOME (001) : 연결이 성공적으로 이루어졌을 때의 환영 메시지

    ruby
    :server.example.com 001 MyNickName :Welcome to the IRC Network MyNickName!user@host
    
  2. ERR_NICKNAMEINUSE (433):

    • 클라이언트가 설정하려는 닉네임이 이미 사용 중인 경우의 에러 메시지입니다.
    ruby
    :server.example.com 433 * MyNickName :Nickname is already in use.
    
  3. RPL_TOPIC (332):

    • 채널의 토픽을 알려주는 메시지입니다.
    ruby
    :server.example.com 332 MyNickName #example_channel :This is the topic of the channel
    
  4. RPL_NAMREPLY (353):

    • 채널에 현재 참여 중인 사용자 목록을 보여주는 메시지입니다.
    ruby
    :server.example.com 353 MyNickName = #example_channel :@user1 +user2 user3
    
  5. ERR_UNKNOWNCOMMAND (421):

    • 클라이언트가 알 수 없는 명령어를 사용했을 때의 에러 메시지입니다.
    ruby
    :server.example.com 421 MyNickName UNKNOWNCOMMAND :Unknown command