Tcl Library Source Code

Bounty program for improvements to Tcl and certain Tcl packages.

[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]


nntp - Tcl client for the NNTP protocol

Table Of Contents


package require Tcl 8.2
package require nntp ?0.2.1?

::nntp::nntp ?host? ?port? ?nntpName?
nntpName method ?arg arg ...?
nntpName article ?msgid?
nntpName authinfo ?user? ?pass?
nntpName body ?msgid?
nntpName configure
nntpName configure option
nntpName configure option value ...
nntpName cget option
nntpName date
nntpName group ?group?
nntpName head ?msgid?
nntpName help
nntpName last
nntpName list
nntpName listgroup ?group?
nntpName mode_reader
nntpName newgroups since
nntpName newnews
nntpName newnews since
nntpName newnews group ?since?
nntpName next
nntpName post article
nntpName slave
nntpName stat ?msgid?
nntpName quit
nntpName xgtitle ?group_pattern?
nntpName xhdr field ?range?
nntpName xover ?range?
nntpName xpat field range ?pattern_list?


The package nntp provides a simple Tcl-only client library for the NNTP protocol. It works by opening the standard NNTP socket on the server, and then providing a Tcl API to access the NNTP protocol commands. All server errors are returned as Tcl errors (thrown) which must be caught with the Tcl catch command.



A bigger example for posting a single article.

package require nntp
set n [nntp::nntp NNTP_SERVER]
$n post "From: [email protected] (USER_FULL)
Newsgroups: alt.test
Subject: Tcl test post -ignore
Message-ID: <[pid][clock seconds]
Date: [clock format [clock seconds] -format "%a, %d %
b %y %H:%M:%S GMT" -gmt true]

Test message body"

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category nntp of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.


news, nntp, nntpclient, rfc 1036, rfc 977