On this page
|
| SUMMARY | |
| Protocol |
: |
Network News Transfer Protocol |
| Protocol suite |
: |
TCP/IP |
| Layer |
: |
Application Layer |
| Type |
: |
News protocol |
| Ports |
: |
119 (TCP) |
| URI |
: |
nntp |
| Working groups |
: |
Nntpext, NNTP Extensions |
|
| DESCRIPTION |
NNTP specifies a protocol for the distribution, inquiry, retrieval, and posting of news articles using a reliable stream (such as TCP), based transmission of news, server-client model. NNTP is designed to accept connections from hosts, and to provide a simple interface to the news database. This server is only an interface between programs and the news databases. It does not perform any user interaction or presentation- level functions. These "user-friendly" functions are better left to the client programs, which have a better understanding of the environment in which they are operating.
NNTP is a request-reply protocol in the style of SMTP or FTP. Unlike mail, news does not require separate protocols for user-to-host and host-to-host exchanges. NNTP is used in all cases. NNTP has facilities to support reading newsgroups, posting new articles, and transferring articles between news servers.
There are thousands of different newsgroups related to computers, social issues, science, the humanities, recreation, and other topics. NNTP used to send Usenet news messages between servers and from a news server to newsreader clients. It is a fairly simple protocol, similar in many ways to POP3 or SMTP and is of interest in part because of its simplicity (it's a lot easier to write one's own NNTP implementation for fun than it is to write one's own IMAP implementation for fun).
USENET servers use NNTP to exchange news articles among themselves. NNTP is also used by clients who need to read news articles on USENET servers. The server-to-server and user-to-server connections are described here:
- Server-to-server exchanges
In the server-to-server exchange, one server either requests the latest articles from another server (pull) or allows the other server to push new articles to it. In either case, both servers engage in a conversation in which specific newsgroup information is requested and then delivered. A primary goal is to prevent the sending system from sending articles that the receiver already has. Select newsgroups and articles can be blocked.
- User-to-server connections
Users run news readers, which are now included with most Web browsers. The user first connects with a newsgroup server (usually located at an ISP (Internet service provider), then downloads a list of available newsgroups. The user can then subscribe to a newsgroup and begin reading articles available in that group or post new articles.
Before NNCP, USENET servers used UUCP (UNIX-to-UNIX Copy Program) to exchange information. UUCP is a "flood broadcast" mechanism. Hosts send new news articles they receive to other hosts, which in turn forward the news on to other hosts that they feed. Usually, a host receives duplicates of articles and must discard those duplicates-a time-consuming process and waste of bandwidth.
NNTP uses an interactive command and response mechanism that lets hosts determine which articles are to be transmitted. A host acting as a client contacts a "server" host using NNTP, and then inquires if any new newsgroups have been created on any of the serving host systems. An administrator can choose to create similar newsgroups on the host he or she manages.
During the same NNTP session, the client requests information about new articles that have arrived in all or some of the newsgroups. The server then sends the client a list of new articles and the client can request transmission of some or all of those articles. The client can refuse to accept articles that it already has.
Character Codes
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
Commands consist of a command word, which in some cases may be followed by a parameter. Commands with parameters must separate the parameters from each other and from the command by one or more space or tab characters. Command lines must be complete with all required parameters, and may not contain more than one command.
Commands and command parameters are not case sensitive. That is, a command or parameter word may be upper case, lower case, or any mixture of upper and lower case.
NNTP commands
| Command | Description | | ARTICLE | There are two forms to the ARTICLE command (and the related BODY, HEAD, and STAT commands), each using a different method of specifying which article is to be retrieved. | | AUTHINFO | AUTHINFO is used to inform a server about the identity of a user of the server. | | CHECK | CHECK is used by a peer to discover if the article with the specified message-id should be sent to the server using the TAKETHIS command. | | DATE | The first NNTP working group discussed and proposed a syntax for this command to help clients find out the current time from the servers perspective. | | GROUP | The 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 | The IHAVE command informs the server that the client has an article whose id is . | | LIST | Returns a list of valid newsgroups and associated information. | | LISTGROUP | The LISTGROUP command is used to get a listing of all the article numbers in a particular news group. | | MODE READER | MODE READER is used by the client to indicate to the server that it is a news reading client. | | MODE STREAM | MODE STREAM is used by a peer to indicate to the server that it would like to suspend the lock step conversational nature of NNTP and send commands in streams. | | NEWGROUPS | A list of newsgroups created since will be listed in the same format as the LIST command. | | NEWNEWS | 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 | After the articles 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. | | SLAVE | Indicates to the server that this client connection is to a slave server, rather than a user. | | TAKETHIS | TAKETHIS is used to send articles to a server when in streaming mode. | | XGTITLE | The XGTITLE command is used to retrieve news group descriptions for specific news groups. | | XHDR | The XHDR command is used to retrieve specific headers from specific articles. | | XINDEX | The XINDEX command is used to retrieve an index file in the format of originally created for use by the TIN [6] news reader. | | XOVER | The XOVER command returns information from the overview database for the article(s) specified. | | XPAT | The XPAT command is used to retrieve specific headers from specific articles, based on pattern matching on the contents of the header. | | XPATH | The XPATH command is used to determine the filenames in which an article is filed. It first appeared in INN. | | XREPLIC | The XREPLIC command makes is possible to exactly duplicate the news spool structure of one server in another server. | | XROVER | The XROVER command returns reference information from the overview database for the article(s) specified. | | XTHREAD | The XTHREAD command is used to retrieve threading information in format of originally created for use by the TRN news reader. |
Responses
Responses are of two kinds, textual and status.
- Text Responses
Text is sent only after a numeric status response line has been sent that indicates that text will follow. Text is sent as a series of successive lines of textual matter, each terminated with CR-LF pair. A single line containing only a period (.) is sent to indicate the end of the text (i.e., the server will send a CR-LF pair at the end of the last line of text, a period, and another CR-LF pair).
- Status Responses
These are status reports from the server and indicate the response to the last command received from the client.
Status response lines begin with a 3 digit numeric code which is sufficient to distinguish all responses. Some of these may herald the subsequent transmission of text.
The first digit of the response broadly indicates the success, failure, or progress of the previous command.
NNTP Reply Code
| Code | Description | | 1yz | Informative message. | | 2yz | Command ok. | | 3yz | Command ok so far, send the rest of it. | | 4yz | Command was correct, but couldn't be performed for some reason. | | 5yz | Command unimplemented, or incorrect, or a serious program error occurred. | | x0z | Connection, setup, and miscellaneous messages. | | x1z | Newsgroup selection. | | x2z | Article selection. | | x3z | Distribution functions. | | x4z | Posting. | | x8z | Nonstandard (private implementation) extensions. | | x9z | Debugging output. |
- General Responses
The following is a list of general response codes that may be sent by the NNTP server. These are not specific to any one command, but may be returned as the result of a connection, a failure, or some unusual condition.
In general, 1xx codes may be ignored or displayed as desired; code 200 or 201 is sent upon initial connection to the NNTP server depending upon posting permission; code 400 will be sent when the NNTP server discontinues service (by operator request, for example); and 5xx codes indicate that the command could not be performed for some unusual reason.
NNTP Reply Codes
| Code | Description | | 100 | Help text follows. | | 199 | Debug output. | | 200 | Server ready - posting allowed. | | 201 | Server ready - no posting allowed. | | 202 | Slave status noted. | | 205 | Closing connection - goodbye! | | 211 | n f l s group selected. | | 215 | List of newsgroups follows. | | 220 | n article retrieved - head and body follow 221 n article retrieved - head follows. | | 222 | n article retrieved - body follows. | | 223 | n article retrieved - request text separately 230 list of new articles by message-id follows. | | 231 | List of new newsgroups follows. | | 235 | Article transferred ok. | | 240 | Article posted ok. | | 335 | Send article to be transferred. End with .. | | 340 | Send article to be posted. End with .. | | 400 | Service discontinued. | | 411 | No such news group. | | 412 | No newsgroup has been selected. | | 420 | No current article has been selected. | | 421 | No next article in this group. | | 422 | No previous article in this group. | | 423 | No such article number in this group. | | 430 | No such article found. | | 435 | Article not wanted - do not send it. | | 436 | Transfer failed - try again later. | | 437 | Article rejected - do not try again. | | 440 | Posting not allowed. | | 441 | Posting failed. | | 500 | Command not recognized. | | 501 | Command syntax error. | | 502 | Access restriction or permission denied. | | 503 | Program fault - command not performed. |
Common NNTP Extensions
| Command | Description | | LIST ACTIVE.TIMES | The active.times file is maintained by some news transports systems to contain information about the when and who created a particular news group. | | LIST DISTRIBUTIONS | The distributions file is maintained by some news transport systems to contain information about valid values for the Distribution: line in a news article header and about what the values mean. | | LIST DISTRIB.PATS | The distrib.pats file is maintained by some news transport systems to contain default values for the Distribution:?line in a news article header when posting to particular news groups. | | LIST NEWSGROUPS | The newsgroups file is maintained by some news transport systems to contain the name of each news group which is active on the server and a short description about the purpose of each news group. | | LIST OVERVIEW.FMT | The overview.fmt file is maintained by some news transport systems to contain the order in which header information is stored in the overview databases for each news group. | | LIST SUBSCRIPTIONS | This command is used to get a default subscription list for new users of this server.?The order of groups is significant. | | LISTGROUP | The LISTGROUP command is used to get a listing of all the article numbers in a particular news group. |
|
Top of Page
|
| EXAMPLES |
Example 1: relative access with NEXT
S: (listens at TCP port 119)
C: (requests connection on TCP port 119)
S: 200 wombatvax news server ready - posting ok
(client asks for a current newsgroup list)
C: LIST
S: 215 list of newsgroups follows
S: net.wombats 00543 00501 y
S: net.unix-wizards 10125 10011 y
(more information here)
S: net.idiots 00100 00001 n
S: .
(client selects a newsgroup)
C: GROUP net.unix-wizards
S: 211 104 10011 10125 net.unix-wizards group selected
(there are 104 articles on file, from 10011 to 10125)
(client selects an article to read)
C: STAT 10110
S: 223 10110 <23445@sdcsvax.ARPA> article retrieved - statistics
only (article 10110 selected, its message-id is
<23445@sdcsvax.ARPA>)
(client examines the header)
C: HEAD
S: 221 10110 <23445@sdcsvax.ARPA> article retrieved - head
follows (text of the header appears here)
S: .
(client wants to see the text body of the article)
C: BODY
S: 222 10110 <23445@sdcsvax.ARPA> article retrieved - body
follows (body text here)
S: .
(client selects next article in group)
C: NEXT
S: 223 10113 <21495@nudebch.uucp> article retrieved - statistics
only (article 10113 was next in group)
(client finishes session)
C: QUIT
S: 205 goodbye. Example 2: absolute article access with ARTICLE
S: (listens at TCP port 119)
C: (requests connection on TCP port 119)
S: 201 UCB-VAX netnews server ready -- no posting allowed
C: GROUP msgs
S: 211 103 402 504 msgs Your new group is msgs
(there are 103 articles, from 402 to 504)
C: ARTICLE 401
S: 423 No such article in this newsgroup
C: ARTICLE 402
S: 220 402 <4105@ucbvax.ARPA> Article retrieved, text follows
S: (article header and body follow)
S: .
C: HEAD 403
S: 221 403 <3108@mcvax.UUCP> Article retrieved, header follows
S: (article header follows)
S: .
C: QUIT
S: 205 UCB-VAX news server closing connection. Goodbye. Example 3: NEWGROUPS command
S: (listens at TCP port 119)
C: (requests connection on TCP port 119)
S: 200 Imaginary Institute News Server ready (posting ok)
(client asks for new newsgroups since April 3, 1985)
C: NEWGROUPS 850403 020000
S: 231 New newsgroups since 03/04/85 02:00:00 follow
S: net.music.gdead
S: net.games.sources
S: .
C: GROUP net.music.gdead
S: 211 0 1 1 net.music.gdead Newsgroup selected
(there are no articles in that newsgroup, and
the first and last article numbers should be ignored)
C: QUIT
S: 205 Imaginary Institute news server ceasing service. Bye! Example 4: posting a news article
S: (listens at TCP port 119)
C: (requests connection on TCP port 119)
S: 200 BANZAIVAX news server ready, posting allowed.
C: POST
S: 340 Continue posting; Period on a line by itself to end
C: (transmits news article in RFC850 format)
C: .
S: 240 Article posted successfully.
C: QUIT
S: 205 BANZAIVAX closing connection. Goodbye. Example 5: interruption due to operator request
S: (listens at TCP port 119)
C: (requests connection on TCP port 119)
S: 201 genericvax news server ready, no posting allowed.
(assume normal conversation for some time, and
that a newsgroup has been selected)
C: NEXT
S: 223 1013 <5734@mcvax.UUCP> Article retrieved; text separate.
C: HEAD
C: 221 1013 <5734@mcvax.UUCP> Article retrieved; head follows.
S: (sends head of article, but halfway through is
interrupted by an operator request. The following
then occurs, without client intervention.)
S: (ends current line with a CR-LF pair)
S: .
S: 400 Connection closed by operator. Goodbye.
S: (closes connection) Example 6: Using the news server to distribute news between systems.
S: (listens at TCP port 119)
C: (requests connection on TCP port 119)
S: 201 Foobar NNTP server ready (no posting)
(client asks for new newsgroups since 2 am, May 15, 1985)
C: NEWGROUPS 850515 020000
S: 235 New newsgroups since 850515 follow
S: net.fluff
S: net.lint
S: .
(client asks for new news articles since 2 am, May 15, 1985)
C: NEWNEWS * 850515 020000
S: 230 New news since 850515 020000 follows
S: <1772@foo.UUCP>
S: <87623@baz.UUCP>
S: <17872@GOLD.CSNET>
S: .
(client asks for article <1772@foo.UUCP>)
C: ARTICLE <1772@foo.UUCP>
S: 220 <1772@foo.UUCP> All of article follows
S: (sends entire message)
S: .
(client asks for article <87623@baz.UUCP>
C: ARTICLE <87623@baz.UUCP>
S: 220 <87623@baz.UUCP> All of article follows
S: (sends entire message)
S: .
(client asks for article <17872@GOLD.CSNET>
C: ARTICLE <17872@GOLD.CSNET>
S: 220 <17872@GOLD.CSNET> All of article follows
S: (sends entire message)
S: .
(client offers an article it has received recently)
C: IHAVE <4105@ucbvax.ARPA>
S: 435 Already seen that one, where you been?
(client offers another article)
C: IHAVE <4106@ucbvax.ARPA>
S: 335 News to me! to end.
C: (sends article)
C: .
S: 235 Article transferred successfully. Thanks.
(or)
S: 436 Transfer failed.
(client is all through with the session)
C: QUIT
S: 205 Foobar NNTP server bids you farewell. |
Top of Page
|
| PROTOCOL RELATIONS |
■ Parent layer
■ Child layer
TCP
|  | NNTP | |
Top of Page
|
| GLOSSARY |
|
FTP FTP (File Transfer Protocol) is the protocol for exchanging files over the Internet. FTP works in the same way as HTTP for transferring Web pages from a server to a user's browser and SMTP for transferring electronic mail across the Internet in that, like these technologies, FTP uses the Internet's TCP/IP protocols to enable data transfer.
FTP is most commonly used to download a file from a server using the Internet or to upload a file to a server (e.g., uploading a Web page file to a server).
IMAP IMAP 9Internet Message Access Protocol) is a protocol for retrieving e-mail messages. The latest version, IMAP4, is similar to POP3 but supports some additional features. For example, with IMAP4, you can search through your e-mail messages for keywords while the messages are still on mail server. You can then choose which messages to download to your machine.
POP3 POP3 (Post Office Protocol 3) is the most recent version of a standard protocol for receiving e-mail. POP3 is a client/server protocol in which e-mail is received and held for you by your Internet server. Periodically, you (or your client e-mail receiver) check your mail-box on the server and download any mail, probably using POP3. This standard protocol is built into most popular e-mail products, such as Eudora and Outlook Express. It's also built into the Netscape and Microsoft Internet Explorer browsers.
SMTP SMTP (Simple Mail Transfer Protocol) is a protocol for sending e-mail messages between servers. Most e-mail systems that send mail over the Internet use SMTP to send messages from one server to another; the messages can then be retrieved with an e-mail client using either POP or IMAP. In addition, SMTP is generally used to send messages from a mail client to a mail server. This is why you need to specify both the POP or IMAP server and the SMTP server when you configure your e-mail application.
USENET News System In the UNIX world the USENET News system provides a method of a worthwhile reduction of the amount of these resources used can be achieved if articles are stored in a central database on the receiving host instead of in each subscriber's mailbox. There is a central repository of the news articles in one place (customarily a spool directory of some sort), and a set of programs that allow a subscriber to select those items he wishes to read. Indexing, cross-referencing, and expiration of aged messages are also provided.
UUCP UUCP (UNIX-to-UNIX Copy Program) is a Unix utility and protocol that enables one computer to send files to another computer over a direct serial connection or via modems and the telephone system. For most file transfer applications, UUCP has been superseded by other protocols, such as FTP, SMTP and NNTP.
|
Top of Page
|
| REFERENCES |
RFCs:
[ RFC 977] Network News Transfer Protocol. A Proposed Standard for the Stream-Based Transmission of News.
[ RFC 1036] Standard for Interchange of USENET Messages.
Obsoletes: RFC 850.
[ RFC 2980] Common NNTP Extensions.
[ RFC 3675] .sex Considered Dangerous. Obsolete RFCs:
[ RFC 850] Standard for Interchange of USENET Messages.
Obsoleted by: RFC 1036.
|
Top of Page
|
| OTHER PROTOCOLS OF TCP/IP SUITE |
|
|
|
|
|