Client-to-client protocol

Client-To-Client Protocol (CTCP) is a special type of communication between Internet Relay Chat (IRC) clients.

CTCP is a common protocol implemented by most major IRC clients in use today. CTCP extends the original IRC protocol by allowing users to query other clients for specific information. Additionally, CTCP can be used to encode messages that the raw IRC protocol would not allow to be sent over the link, such as messages containing newslines or theĀ byte value 0.

CTCP allows users to query a remote client about the version of the client they are using (via CTCP VERSION), the time (via CTCP TIME), or get remote user info (via CTCP USERINFO), among other things. It is used to implement the /me command (via CTCP ACTION). CTCP is also used to negotiate DCC connections.

A CTCP message is implemented as a PRIVMSG where the first and last characters of the message are ASCII value 0x01. Additionally, characters which would not be allowed in the IRC protocol are escaped. Since a PRIVMSG as a rule should not generate another PRIVMSG as a reply, a CTCP reply is implemented with a NOTICE instead of a PRIVMSG, but the syntax of the CTCP reply is otherwise identical to a CTCP message.

What's IRC?
Example of a Java IRC Bot