NNTP specifies a protocol for the distribution, inquiry, retrieval, and posting of news articles using a reliable stream-based, client-server model transmission of news. NNTP is designed so that news articles are stored in a central database allowing a subscriber to select only those items he wishes to read. There are popularly two methods of distributing such news:
Internet method of direct mailing:- This works on principle of remailing a copy of the information to be distributed to each subscriber on the mailing list. Such remailing is inefficient since sending a separate copy to each of the subscribers occupies large quantities of network bandwidth, CPU resources, and significant amounts of disk storage at the destination host. Here the news are send from one host to others by flooding it to all ,but since hosts are redundantly feed, each host gets a no. of copy of the news. USENET news system:- Here the articles are stored in a central database on the receiving host instead of in each subscriber's mailbox. The NNTP server runs as a background process on one hothe NNTP server runs as a background process on one host, and would accept connections from other hosts on the LAN. This works well when there are a number of small computer systems (such as workstations, with only one or at most a few users each), and a large central server. For clusters of machines with many users in intermediate server might be used. This intermediate or "slave" server runs on each computer system, and is responsible for mediating news reading requests and performing local caching of recently-retrieved news articles.
Mechanism for deciding which articles are to be transmitted:-
A host desiring new news, or which has new news to send, will typically
contact one or more of its neighbors using NNTP. First it will inquire
if any new news groups have been created on the serving host by means of
the NEWGROUPS command. The client host will then inquire as to which new
articles have arrived in all or some of the newsgroups that it desires
to receive, using the NEWNEWS command.It will receive a list of
new articles from the server, and can request transmission of those articles
that it desires and does not already have. Finally, the client can advise
the server of those new articles which the client has recently received.
The server will indicate those articles that it has already obtained copies of, and which articles
should be sent to add to its collection.
COMMANDS AND RESPONSES
Commands and replies are composed of characters from the ASCII character
set. When the transport service provides an 8-bit byte (octet) transmission
channel, each 7-bit character is transmitted right justified in an octet
with the high order bit cleared to zero. Commands consist of a command
word, which in some cases may be followed by a parameter. Command lines
shall not exceed 512 characters in length including spaces, separators,
punctuaion, and the trailing CR-LF.
Responses are of two kinds, textual and status.Text is sent only after
a numeric status response line has been sent that indicates that text will
follow. A single line containing only a period (.) is sent to indicate
the end of the text. Status Responses are status reports from the
server and indicate the response to the last command received from the
client.
ARTICLE
ARTICLE <message-id>Display the header, a blank line, then the body
(text) of the
specified article. The internally-maintained "current
article pointer" is NOT ALTERED by this command.
ARTICLE [nnn]Displays the header, a blank line, then the body (text)
of the current or specified article. The optional parameter nnn is
the numeric id of an article in the current newsgroup and must be chosen
from the range ofDisplays the header, a blank line, then the body (text)
of the
current or specified article provided when the newsgroup was
selected.The internally-maintained "current article pointer" is set by
this command if a valid article number is specified.
GROUP ggg :-Here ggg is the name of the newsgroup to be selectedThe successful selection response will return the article numbers of the first and last articles in the group, and an estimate of the number of articles on file in the group.
HELP :- Provides a short summary of commands that are understood by this implementation of the server.
IHAVE <messageid> :- The IHAVE command informs the server that the client has an article whose id is <messageid>.
LAST:-The internally-maintained "current article pointer" is set by this command.
LIST:- Returns a list of valid newsgroups and associated information.
NEWGROUPS:-A list of newsgroups created since <date and time> will be listed in the same format as the LIST command.
NEWNEWS newsgroups date time [GMT] [<distribution>] :- A list of message-ids of articles posted or received to the specified newsgroup since "date" will be listed.
NEXT:- The internally maintained "current article pointer" is advanced to the next article in the current newsgroup.
POST :-If posting is permitted, the article should include all required header lines. After the article's header and body have been completely sent by the client to the server, a further response code will be returned to indicate success or failure of the posting attempt.
QUIT:- The server process acknowledges the QUIT command and then closes the connection to the client. This is the preferred method for a client to indicate that it has finished all its transactions with the NNTP server.
SLAVE:- Indicates to the server that this client connection is
to a slave server, rather than a user.
RESPONSES
The first digit of the response broadly indicates the success,
failure, or progress of the previous command.
1xx - Informative message
2xx - Command ok
3xx - Command ok so far, send the rest
of it.
4xx - Command was correct, but couldn't
be performed for some reason.
5xx - Command unimplemented, or incorrect,
or a serious program error occurred.
The next digit in the code indicates the function response category.
x0x - Connection, setup, and miscellaneous
messages
x1x - Newsgroup selection
x2x - Article selection
x3x - Distribution functions
x4x - Posting
x8x - Nonstandard (private implementation)
extensions
x9x - Debugging output
for more on NNTP refer RFC-977