4.18.1.2. Protocol elements

NNTP protocol is a request-response based protocol. The client sends REQUEST commands - text commands with arguments and closed by CRLF (carriage return followed by a line feed). The server answers with a STATUS RESPONSE, which is a 3 digit numeric status indicator code and a text message. After the STATUS RESPONSE comes the answer itself if there is any.

Status responses are reports from the server indicating the result of the last command received from the client. Status response lines begin with a 3 digit numeric code.

The first number indicates the success, failure or the progress of the last command. 1 means informative message is coming, 2 means the command is OK, 3 means the command is OK so far, 4 means the command is OK, but it is temporary unavailable and 5 means the command is incorrect.

The second number indicates the function response category, where 0 means the message is related to connection setup, 1 means the message is about newsgroup selection and 4 means the message is about posting.

The most common STATUS RESPONSEs are "200 server ready, posting allowed", "500 command not recognized" and "201 server ready, posting not allowed".

NNTP defines default commands for reading and posting articles or listing and changing between newsgroups. Several extensions are also available which allow the protocol to implement user identification and authentication.

Example 4.34. Example NNTP connection
200 newsfeed.example.com InterNetNews NNTP server INN 2.3.2 ready (posting ok).
LIST
215 Newsgroups in form "group high low flags".
hun.business.egyeb 0000000091 0000000088 y
hun.comp.lang.java 0000054077 0000050155 m
hun.comp.lang.madach 0000000000 0000000001 y
hun.comp.net 0000000009 0000000009 y
hun.comp.os.os2 0000000002 0000000002 y
hun.comp.os.solaris 0000000007 0000000007 y
hun.comp.text.tex 0000000007 0000000007 y
hun.flame 0000000065 0000000065 y
GROUP hun.comp.lang.java
211 3923 50155 54077 hun.comp.lang.java
ARTICLE 54077
220 54077 <XXXXXXXX.XXXXXXXX@foo.hu> article
Path: newsfeed.example.com
Distribution: hun
Subject:
.
Article comes here...
.
.
QUIT
205 .