Provided by Colasoft Co., Ltd.

NNTP ( Network News Transfer Protocol )

Home > Protocols > NNTP Update: 2005-11-10 16:04:33    I have words to say about this protocol
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
    CommandDescription
    ARTICLEThere 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.
    AUTHINFOAUTHINFO is used to inform a server about the identity of a user of the server.
    CHECKCHECK 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.
    DATEThe first NNTP working group discussed and proposed a syntax for this command to help clients find out the current time from the servers perspective.
    GROUPThe 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.
    HELPProvides a short summary of commands that are understood by this implementation of the server.
    IHAVEThe IHAVE command informs the server that the client has an article whose id is .
    LISTReturns a list of valid newsgroups and associated information.
    LISTGROUPThe LISTGROUP command is used to get a listing of all the article numbers in a particular news group.
    MODE READERMODE READER is used by the client to indicate to the server that it is a news reading client.
    MODE STREAMMODE 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.
    NEWGROUPSA list of newsgroups created since will be listed in the same format as the LIST command.
    NEWNEWSA list of message-ids of articles posted or received to the specified newsgroup since "date" will be listed.
    NEXTThe internally maintained "current article pointer" is advanced to the next article in the current newsgroup.
    POSTAfter 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.
    QUITThe server process acknowledges the QUIT command and then closes the connection to the client.
    SLAVEIndicates to the server that this client connection is to a slave server, rather than a user.
    TAKETHISTAKETHIS is used to send articles to a server when in streaming mode.
    XGTITLEThe XGTITLE command is used to retrieve news group descriptions for specific news groups.
    XHDRThe XHDR command is used to retrieve specific headers from specific articles.
    XINDEXThe XINDEX command is used to retrieve an index file in the format of originally created for use by the TIN [6] news reader.
    XOVERThe XOVER command returns information from the overview database for the article(s) specified.
    XPATThe XPAT command is used to retrieve specific headers from specific articles, based on pattern matching on the contents of the header.
    XPATHThe XPATH command is used to determine the filenames in which an article is filed. It first appeared in INN.
    XREPLICThe XREPLIC command makes is possible to exactly duplicate the news spool structure of one server in another server.
    XROVERThe XROVER command returns reference information from the overview database for the article(s) specified.
    XTHREADThe 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
      CodeDescription
      1yzInformative message.
      2yzCommand ok.
      3yzCommand ok so far, send the rest of it.
      4yzCommand was correct, but couldn't be performed for some reason.
      5yzCommand unimplemented, or incorrect, or a serious program error occurred.
      x0zConnection, setup, and miscellaneous messages.
      x1zNewsgroup selection.
      x2zArticle selection.
      x3zDistribution functions.
      x4zPosting.
      x8zNonstandard (private implementation) extensions.
      x9zDebugging 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
      CodeDescription
      100Help text follows.
      199Debug output.
      200Server ready - posting allowed.
      201Server ready - no posting allowed.
      202Slave status noted.
      205Closing connection - goodbye!
      211n f l s group selected.
      215List of newsgroups follows.
      220n article retrieved - head and body follow 221 n article retrieved - head follows.
      222n article retrieved - body follows.
      223n article retrieved - request text separately 230 list of new articles by message-id follows.
      231List of new newsgroups follows.
      235Article transferred ok.
      240Article posted ok.
      335Send article to be transferred. End with ..
      340Send article to be posted. End with ..
      400Service discontinued.
      411No such news group.
      412No newsgroup has been selected.
      420No current article has been selected.
      421No next article in this group.
      422No previous article in this group.
      423No such article number in this group.
      430No such article found.
      435Article not wanted - do not send it.
      436Transfer failed - try again later.
      437Article rejected - do not try again.
      440Posting not allowed.
      441Posting failed.
      500Command not recognized.
      501Command syntax error.
      502Access restriction or permission denied.
      503Program fault - command not performed.



Common NNTP Extensions
CommandDescription
LIST ACTIVE.TIMESThe active.times file is maintained by some news transports systems to contain information about the when and who created a particular news group.
LIST DISTRIBUTIONSThe 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.PATSThe 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 NEWSGROUPSThe 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.FMTThe 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 SUBSCRIPTIONSThis command is used to get a default subscription list for new users of this server.?The order of groups is significant.
LISTGROUPThe 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
AARP   RRP   RTP Video   RTP Audio   RTP   COPS   Gopher   HSRP   ICP   MPLS   IEEE 802.2   CIP   FTP - Data   FTP - Ctrl   IMAPS   IP Fragment   LDAPS   PUP   MSSQL   RSH   SQL   POP3s   RTELNET   RSVP   STP   VLAN   MSN   H.323   MSRDP   HTTPS   WINS   LPD   GTP   ICMPv6   POP   TELNET   H.225   VRRP   PIM   RARP   SAP   OSPF   RLOGIN   SCTP   SIP   RTCP   PPPoE   Mobile IP   IMAP3   WhoIs   SLP   NCP   PPTP   MGCP   LDAP   L2TP   Kerberos   IPv6   GRE   Ethernet SNAP   AFP   CIFS   IEEE 802.3   Finger   NBDGM   NetBEUI   NBSSN   ESP   EIGRP   EGP   DHCP   CGMP   CDP   BOOTP   AH   NBNS   EthernetII   ICQ   PPP   ARP   RIP   IPX   IGRP   IGMP   SSH   RPC   NetBIOS   TFTP   SNMP   SNA   SMB   RADIUS   NTP   NNTP   UDP   TCP   BGP   DNS   SOCKS   IMAP   RTSP   NFS   ICMP   IP   FTP   Telnet   POP3   SMTP   HTTP  
Search RFCs:

Advanced Search
Search Glossary:
Exact search
Fuzzy search


All Protocols
Submit a Request

Recommend an Article

 Layer 7 Application Layer
  AFP
  BOOTP
  CIFS
  CIP
  COPS
  DHCP
  DNS
  Finger
  FTP
  FTP - Ctrl
  FTP - Data
  Gopher
  HSRP
  HTTP
  HTTPS
  ICP
  ICQ
  IMAP
  IMAP3
  IMAPS
  Kerberos
  LPD
  MGCP
  MSN
  MSRDP
  MSSQL
  NCP
  NFS
  NNTP
  NTP
  POP
  POP3
  POP3s
  RADIUS
  RLOGIN
  RRP
  RSH
  RTCP
  RTELNET
  RTP
  RTP Audio
  RTP Video
  RTSP
  SAP
  SIP
  SLP
  SMB
  SMTP
  SNA
  SNMP
  SOCKS
  SSH
  Telnet
  TELNET
  TFTP
  WhoIs
  WINS
 Layer 6 Presentation Layer
  NBNS
  NBSSN
  NCP
  NetBIOS
 Layer 5 Session Layer
  LDAP
  LDAPS
  NCP
  NetBEUI
  RPC
 Layer 4 Transport Layer
  H.225
  H.323
  NBDGM
  NetBEUI
  PUP
  SCTP
  TCP
  UDP
 Layer 3 Network Layer
  AARP
  AH
  BGP
  EGP
  EIGRP
  ESP
  GRE
  GTP
  ICMP
  ICMPv6
  IGMP
  IGRP
  IP
  IP Fragment
  IPv6
  IPX
  Mobile IP
  MPLS
  OSPF
  PIM
  PPPoE
  RIP
  RSVP
  STP
  VRRP
 Layer 2 Data Link Layer
  ARP
  CDP
  CGMP
  Ethernet SNAP
  EthernetII
  IEEE 802.2
  IEEE 802.3
  L2TP
  PPP
  PPTP
  RARP
  SQL
  VLAN
 Layer 1 Physical Layer
© 2006 - 2007 Colasoft Co., Ltd. All rights reserved.